Skip to content

Conversation

@fdrozdowski
Copy link
Contributor

@fdrozdowski fdrozdowski commented Mar 10, 2020

Pull request checklist

Please check if your PR fulfills the following requirements:

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been reviewed and added / updated if needed (for bug fixes / features)
  • Build was run locally and any changes were pushed
  • Lint has passed locally and any fixes were made for failures

Pull request type

Please check the type of change your PR introduces:

  • Bugfix
  • Feature
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Documentation content changes
  • Other (please describe):

What is the current behavior?

After Click 7.1 release (March 9, 2020), the CLI tests started failing with errors of this sort:

E         - Try 'delphix-sdk build -h' for help.
E         ?     ^                    ^
E         + Try "delphix-sdk build -h" for help.
E         ?     ^   

It looks like the click CLI now outputs single rather than double quotes in its error messages. This is related to the following commit that did manual cleanup before the release. The commit has been shipped in versions 7.1 and 7.1.1.

What is the new behavior?

Modify CLI tests to expect single rather than double quotes.

Does this introduce a breaking change?

  • Yes
  • No

Other information

@fdrozdowski fdrozdowski self-assigned this Mar 10, 2020
@fdrozdowski fdrozdowski requested a review from ankursarin March 10, 2020 01:42
@fdrozdowski fdrozdowski marked this pull request as ready for review March 10, 2020 01:42
nhlien93
nhlien93 previously approved these changes Mar 10, 2020
Comment on lines 322 to 326
u'\nTry "delphix-sdk build -h" for help.'
u'\nTry \'delphix-sdk build -h\' for help.'
u'\n'
u'\nError: Invalid value for "-c" /'
u' "--plugin-config": File'
u' "/not/a/real/file/plugin_config.yml"'
u'\nError: Invalid value for \'-c\' /'
u' \'--plugin-config\': File'
u' \'/not/a/real/file/plugin_config.yml\''
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I think our standard is if you're using single quotes in the string, we can then use double quotes to start the string (so that we don't have to use backslash):
so it would be something like:

assert result.output == (u"Usage: delphix-sdk build [OPTIONS]"
                                         u"\nTry 'delphix-sdk build -h' for help."
                                         u"\n"
                                         u"\nError: Invalid value for '-c' /"
                                         u"'--plugin-config': File"
                                         u" '/not/a/real/file/plugin_config.yml'"

Comment on lines 473 to 480
assert result.output == (u'Usage: delphix-sdk upload [OPTIONS]'
u'\nTry "delphix-sdk upload -h" for help.'
u'\nTry \'delphix-sdk upload -h\' for help.'
u'\n'
u'\nError: Invalid value for "-a" /'
u' "--upload-artifact": File'
u' "/not/a/real/file/artifact.json"'
u'\nError: Invalid value for \'-a\' /'
u' \'--upload-artifact\': File'
u' \'/not/a/real/file/artifact.json\''
u' does not exist.'
u'\n')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here and elsewhere

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's what I was going to do but then I would have to change the entire test_cli.py to be consistent. I will have to check what convention we followed in other files.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just read the following recommendation from PEP8 (https://www.python.org/dev/peps/pep-0008/):

In Python, single-quoted strings and double-quoted strings are the same. This PEP does not make a recommendation for this. Pick a rule and stick to it. When a string contains single or double quote characters, however, use the other one to avoid backslashes in the string. It improves readability.

I will get rid of the backslashes.

ravi-cm
ravi-cm previously approved these changes Mar 10, 2020
Copy link
Contributor

@ravi-cm ravi-cm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Please run a CLI dvp to make sure o/p is fine for the help option or if a an argument is missed.

@fdrozdowski fdrozdowski dismissed stale reviews from ravi-cm and nhlien93 via cc046bc March 10, 2020 16:46
Copy link
Contributor

@ankursarin ankursarin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we also need to change tools/setup.py to update the version of click to be
"click >= 7.1"?

Copy link
Contributor

@ankursarin ankursarin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ship it!

@fdrozdowski fdrozdowski requested review from nhlien93 and ravi-cm March 10, 2020 17:05
@fdrozdowski fdrozdowski merged commit 6e2f4bb into delphix:develop Mar 10, 2020
@fdrozdowski fdrozdowski deleted the fix_click_output branch March 10, 2020 17:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

5 participants