Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Conan V2 cli broken help #7394

Merged
merged 9 commits into from Jul 21, 2020
Merged

Conversation

czoido
Copy link
Contributor

@czoido czoido commented Jul 21, 2020

Changelog: Fix: Fixing --help for commands in proposal for command line v2.0.
Docs: omit

Closes: #7366

  • Refer to the issue that supports this Pull Request.
  • If the issue has missing info, explain the purpose/use case/pain/need that covers this Pull Request.
  • I've read the Contributing guide.
  • I've followed the PEP8 style guides for Python code.
  • I've opened another PR in the Conan docs repo to the develop branch, documenting this one.

Note: By default this PR will skip the slower tests and will use a limited set of python versions. Check here how to increase the testing level by writing some tags in the current PR body text.

@czoido czoido added this to the 1.28 milestone Jul 21, 2020
Copy link
Member

@memsharded memsharded left a comment

Choose a reason for hiding this comment

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

Looking good, can be merged.

conans/cli/command.py Outdated Show resolved Hide resolved
@@ -81,13 +81,15 @@ def __init__(self, conan_api):
self._commands = {}
conan_commands_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "commands")
for module in pkgutil.iter_modules([conan_commands_path]):
self._add_command("conans.cli.commands.{}".format(module.name), module.name)
module_name = module[1]
Copy link
Member

Choose a reason for hiding this comment

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

Is this a Py2.7 thing? If that is the case, I am happy with the check you did in the test to run the test only in Py3

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is because in 3.5 they changed the return from a tuple to a named tuple for iter_modules return value:
https://docs.python.org/3.5/library/pkgutil.html#pkgutil.iter_modules
https://docs.python.org/3.6/library/pkgutil.html#pkgutil.iter_modules
Python2 issue is another one.

from conans.test.utils.tools import TestClient


@unittest.skipIf(six.PY2, "v2.0: Only testing for Python 3")
Copy link
Member

Choose a reason for hiding this comment

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

Probably both the skipIf and the run() method can be put in a common class and all command_v2 tests use it.

@czoido czoido merged commit c31790a into conan-io:develop Jul 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[bug] Conan V2 cli broken help
2 participants