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

{Misc.} Change deprecated assertRaisesRegexp to assertRaisesRegex #20374

Merged
merged 2 commits into from
Nov 22, 2021

Conversation

jiasli
Copy link
Member

@jiasli jiasli commented Nov 17, 2021

Description

According to https://docs.python.org/3/library/unittest.html#deprecated-aliases, assertRaisesRegexp has been replaced with assertRaisesRegex.

pytest now files DeprecationWarning in Python 3.10 for assertRaisesRegexp (#20195):

> pytest src/azure-cli-core/azure/cli/core/tests/test_profile.py

azure/cli/core/tests/test_profile.py::TestProfile::test_get_auth_info_for_logged_in_service_principal
  D:\cli\py310\lib\site-packages\win32\lib\pywintypes.py:51: DeprecationWarning: getargs: The 'u' format is deprecated. Use 'U' instead.
    found = _win32sysloader.GetModuleFilename(filename)

azure/cli/core/tests/test_profile.py::TestProfile::test_get_login_credentials_aux_tenants
  D:\cli\azure-cli\src\azure-cli-core\azure\cli\core\tests\test_profile.py:935: DeprecationWarning: Please use assertRaisesRegex instead.
    with self.assertRaisesRegexp(CLIError,

azure/cli/core/tests/test_profile.py::TestProfile::test_get_raw_token_in_cloud_console
  D:\cli\azure-cli\src\azure-cli-core\azure\cli\core\tests\test_profile.py:1171: DeprecationWarning: Please use assertRaisesRegex instead.
    with self.assertRaisesRegexp(CLIError, 'Cloud Shell'):

azure/cli/core/tests/test_profile.py::TestProfile::test_get_raw_token_msi_system_assigned
  D:\cli\azure-cli\src\azure-cli-core\azure\cli\core\tests\test_profile.py:1138: DeprecationWarning: Please use assertRaisesRegex instead.
    with self.assertRaisesRegexp(CLIError, "MSI"):

@jiasli jiasli self-assigned this Nov 17, 2021
@jiasli jiasli added this to the Nov 2021 (2021-12-07) milestone Nov 17, 2021
@yonzhan
Copy link
Collaborator

yonzhan commented Nov 17, 2021

Misc

@jiasli jiasli merged commit 7af6c5b into Azure:dev Nov 22, 2021
@jiasli jiasli deleted the regex branch November 22, 2021 03:04
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.

None yet

6 participants