-
Notifications
You must be signed in to change notification settings - Fork 3.3k
{Misc.} Remove usages of six
#19554
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
{Misc.} Remove usages of six
#19554
Conversation
| 'PyJWT>=2.1.0', | ||
| 'pyopenssl>=17.1.0', # https://github.com/pyca/pyopenssl/pull/612 | ||
| 'requests[socks]~=2.25.1', | ||
| 'six~=1.12', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove the dependency from azure-cli-core.
| 'pytz==2019.1', | ||
| 'scp~=0.13.2', | ||
| 'semver==2.13.0', | ||
| 'six>=1.10.0', # six is still used by countless extensions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add six to azure-cli as it can be used by extensions.
|
Misc |
| # the urlopen is imported for automation purpose | ||
| from six.moves.urllib.request import urlopen # noqa, pylint: disable=import-error,unused-import,ungrouped-imports | ||
| from urllib.request import urlopen # noqa, pylint: disable=import-error,unused-import,ungrouped-imports |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
urlopen is never used by custom.py but is patched by test
azure-cli/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_vm_image.py
Line 30 in 8700432
| @mock.patch('azure.cli.command_modules.vm.custom.urlopen', autospec=True) |
What is exactly "automation purpose"?
@zhoxing-ms, Could you help confirm if we can remove this line?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is because in the previous PR #5328, the reference of urlopen in the method load_images_from_aliases_doc() was modified to use requests, but the mock path in test_read_images_from_alias_doc() was not synchronously modified.

code link
Therefore, the import of from six.moves.urllib.request import urlopen can be deleted, and we just need to change the mock path to @mock.patch(azure.cli.command_modules.vm.custom.requests, autospec=True)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can do this in a separate PR if time permits.
# Conflicts: # src/azure-cli/setup.py
Description
sixwas previously dropped fromazure-cli-core(#17366). It should be dropped fromazure-clias well.However, as there are countless extensions still using
six, we still need to install it. This PR removes all usages of `six.