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

azure-cli-testsdk on main branch does not work with latest version of azure-cli/azure-cli-core (2.29.1) available on PyPi #19976

Closed
needuv opened this issue Oct 21, 2021 · 2 comments
Assignees
Labels
Core CLI core infrastructure MSAL

Comments

@needuv
Copy link
Member

needuv commented Oct 21, 2021

az feedback auto-generates most of the information requested below, as of CLI version 2.0.62

Describe the bug

When running CLI tests using azure-cli-testsdk framework and the latest version of azure-cli available on PyPi (2.29.1), we get the following error:

[gw8] win32 -- Python 3.7.9 c:\hostedtoolcache\windows\python\3.7.9\x64\python.exe
thing = <module 'azure.cli.core.auth' from 'c:\\hostedtoolcache\\windows\\python\\3.7.9\\x64\\lib\\site-packages\\azure\\cli\\core\\auth\\__init__.py'>
comp = 'identity', import_path = 'azure.cli.core.auth.identity'
    def _dot_lookup(thing, comp, import_path):
        try:
>           return getattr(thing, comp)
E           AttributeError: module 'azure.cli.core.auth' has no attribute 'identity'
c:\hostedtoolcache\windows\python\3.7.9\x64\lib\unittest\mock.py:1152: AttributeError
During handling of the above exception, another exception occurred:
c:\hostedtoolcache\windows\python\3.7.9\x64\lib\site-packages\azure_devtools\scenario_tests\base.py:146: in setUp
    patch(self)
..\azure-cli\src\azure-cli-testsdk\azure\cli\testsdk\patches.py:76: in patch_retrieve_token_for_user
    mock_in_unit_test(unit_test, 'azure.cli.core.auth.identity.UserCredential', UserCredentialMock)
c:\hostedtoolcache\windows\python\3.7.9\x64\lib\site-packages\azure_devtools\scenario_tests\patches.py:36: in mock_in_unit_test
    mp.__enter__()
c:\hostedtoolcache\windows\python\3.7.9\x64\lib\unittest\mock.py:1291: in __enter__
    self.target = self.getter()
c:\hostedtoolcache\windows\python\3.7.9\x64\lib\unittest\mock.py:1465: in <lambda>
    getter = lambda: _importer(target)
c:\hostedtoolcache\windows\python\3.7.9\x64\lib\unittest\mock.py:1165: in _importer
    thing = _dot_lookup(thing, comp, import_path)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
thing = <module 'azure.cli.core.auth' from 'c:\\hostedtoolcache\\windows\\python\\3.7.9\\x64\\lib\\site-packages\\azure\\cli\\core\\auth\\__init__.py'>
comp = 'identity', import_path = 'azure.cli.core.auth.identity'
    def _dot_lookup(thing, comp, import_path):
        try:
            return getattr(thing, comp)
        except AttributeError:
>           __import__(import_path)
E           ModuleNotFoundError: No module named 'azure.cli.core.auth.identity'
c:\hostedtoolcache\windows\python\3.7.9\x64\lib\unittest\mock.py:1154: ModuleNotFoundError

To Reproduce

Run a CLI test using azure-cli-testsdk with the latest version (2.29.1) of azure-cli installed from Pip.

Expected behavior

azure-cli-testsdk should work with the latest version of azure-cli and azure-cli-core and should be able to patch both packages.

Environment summary

-cli
Cloned azure-cli repo and installed azure-cli-testsdk locally using pip install -e azure-cli/src/azure-cli-testsdk. Installed azure-cli using Pip, which pulled the latest version of the azure-cli/azure-cli-core (2.29.1). Shell type is powershell on Windows.

Additional context

@ghost ghost added the needs-triage This is a new issue that needs to be triaged to the appropriate team. label Oct 21, 2021
@needuv needuv changed the title azure-cli-testsdk on main branch does not work with latest version of azure-cli/azure-cli-core (2.29.1) available on Pip azure-cli-testsdk on main branch does not work with latest version of azure-cli/azure-cli-core (2.29.1) available on PyPi Oct 21, 2021
@yonzhan yonzhan added the Core CLI core infrastructure label Oct 22, 2021
@ghost ghost removed the needs-triage This is a new issue that needs to be triaged to the appropriate team. label Oct 22, 2021
@yonzhan yonzhan added this to the Backlog milestone Oct 22, 2021
@yonzhan
Copy link
Collaborator

yonzhan commented Oct 22, 2021

@jiasli for awareness

@jiasli
Copy link
Member

jiasli commented Oct 22, 2021

Similar to Azure/azure-cli-extensions#3950 (comment).

azure-cli-core and azure-cli-testsdk should be both from the dev branch, main branch. Using azure-cli-core from PyPI but azure-cli-testsdk from dev intermixed is NOT Supported.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Core CLI core infrastructure MSAL
Projects
None yet
Development

No branches or pull requests

3 participants