Skip to content

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

Description

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

CoreCLI core infrastructureMSAL

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions