From 451182d077fab164b5d3a330aea293173791793c Mon Sep 17 00:00:00 2001 From: Hang Lei Date: Fri, 15 Nov 2024 14:55:32 +0800 Subject: [PATCH 1/7] Init --- pylintrc | 1 - scripts/live_test/generate_index.py | 2 +- .../test_staticapp_commands_thru_mock.py | 4 ++-- .../tests/latest/test_bot_commands.py | 22 +++++++++---------- .../command_modules/containerapp/_utils.py | 2 +- .../tests/latest/test_containerapp_utils.py | 2 +- .../containerapp/tests/latest/utils.py | 2 +- .../command_modules/resource/_validators.py | 2 +- 8 files changed, 18 insertions(+), 19 deletions(-) diff --git a/pylintrc b/pylintrc index bbf7f0544f9..ceebf0a1c7d 100644 --- a/pylintrc +++ b/pylintrc @@ -53,7 +53,6 @@ disable= missing-timeout, superfluous-parens, implicit-str-concat, - unnecessary-dunder-call, # These rules were added in Pylint >= 3.2 possibly-used-before-assignment, diff --git a/scripts/live_test/generate_index.py b/scripts/live_test/generate_index.py index 100eeadeb62..fef6692b5a4 100644 --- a/scripts/live_test/generate_index.py +++ b/scripts/live_test/generate_index.py @@ -177,7 +177,7 @@ def render(data, container, container_url, testdata, USER_REPO, USER_BRANCH, COM # elif 'sequential' in name: # display_name = 'sequential' try: - html = requests.get(url).content.__str__() + html = str(requests.get(url).content) pattern = re.compile('\\d+ tests ran in') match = pattern.search(html) number = match.group().split()[0] diff --git a/src/azure-cli/azure/cli/command_modules/appservice/tests/latest/test_staticapp_commands_thru_mock.py b/src/azure-cli/azure/cli/command_modules/appservice/tests/latest/test_staticapp_commands_thru_mock.py index fd3cb4443a0..343cbc1c7d4 100644 --- a/src/azure-cli/azure/cli/command_modules/appservice/tests/latest/test_staticapp_commands_thru_mock.py +++ b/src/azure-cli/azure/cli/command_modules/appservice/tests/latest/test_staticapp_commands_thru_mock.py @@ -618,7 +618,7 @@ def test_list_staticsite_secrets(self): self.staticapp_client.list_static_site_secrets.assert_called_once_with(resource_group_name=self.rg1, name=self.name1) from ast import literal_eval - self.assertEqual(literal_eval(secret.__str__())["properties"]["apiKey"], "key") + self.assertEqual(literal_eval(str(secret))["properties"]["apiKey"], "key") def test_staticsite_identity_assign(self): @@ -656,7 +656,7 @@ def test_reset_staticsite_api_key(self): self.staticapp_client.reset_static_site_api_key.assert_called_once() from ast import literal_eval - reset_envelope = literal_eval(self.staticapp_client.reset_static_site_api_key.call_args[1]["reset_properties_envelope"].__str__()) + reset_envelope = literal_eval(str(self.staticapp_client.reset_static_site_api_key.call_args[1]["reset_properties_envelope"])) self.assertEqual(reset_envelope["repository_token"], self.token1) @mock.patch("azure.cli.command_modules.appservice.static_sites.show_app") diff --git a/src/azure-cli/azure/cli/command_modules/botservice/tests/latest/test_bot_commands.py b/src/azure-cli/azure/cli/command_modules/botservice/tests/latest/test_bot_commands.py index bfde73ef655..730721419cb 100644 --- a/src/azure-cli/azure/cli/command_modules/botservice/tests/latest/test_bot_commands.py +++ b/src/azure-cli/azure/cli/command_modules/botservice/tests/latest/test_bot_commands.py @@ -481,7 +481,7 @@ def test_botservice_create_should_raise_error_for_invalid_app_id_args(self, reso self.cmd('az bot create -g {rg} -n {botname} --appid {numbers_id} --app-type MultiTenant') raise AssertionError() except CLIError as cli_error: - assert cli_error.__str__() == expected_error + assert (str(cli_error)) == expected_error except AssertionError: raise AssertionError('should have thrown an error for appid that is not valid GUID.') @@ -489,7 +489,7 @@ def test_botservice_create_should_raise_error_for_invalid_app_id_args(self, reso self.cmd('az bot create -g {rg} -n {botname} --appid {short_app_id} --app-type MultiTenant') raise AssertionError() except CLIError as cli_error: - assert cli_error.__str__() == expected_error + assert (str(cli_error)) == expected_error except AssertionError: raise AssertionError('should have thrown an error for appid that is not valid GUID.') @@ -497,7 +497,7 @@ def test_botservice_create_should_raise_error_for_invalid_app_id_args(self, reso self.cmd('az bot create -g {rg} -n {botname} --appid "" --app-type MultiTenant') raise AssertionError() except CLIError as cli_error: - assert cli_error.__str__() == expected_error + assert (str(cli_error)) == expected_error except AssertionError: raise AssertionError('should have thrown an error for appid that is not valid GUID.') @@ -527,7 +527,7 @@ def test_botservice_should_throw_if_name_is_unavailable(self, resource_group): 'az bot create -g {rg2} -n {botname} -d {description} -e {endpoint} --appid {app_id} --app-type MultiTenant') raise AssertionError() except CLIError as cli_error: - assert cli_error.__str__().startswith('Unable to create bot.\nReason: ') + assert str(cli_error).startswith('Unable to create bot.\nReason: ') except AssertionError: raise AssertionError('should have thrown an error for unavailable name.') @@ -780,8 +780,8 @@ def test_botservice_prepare_deploy_should_fail_if_code_dir_doesnt_exist(self): prepare_webapp_deploy(language, code_dir, proj_file_path) raise Exception("'az bot prepare-publish' should have failed with nonexistent --code-dir value") except CLIError as cli_error: - print(cli_error.__str__()) - assert cli_error.__str__() == 'Provided --code-dir value (does_not_exist) does not exist' + print(str(cli_error)) + assert (str(cli_error)) == 'Provided --code-dir value (does_not_exist) does not exist' except Exception as error: raise error @@ -794,7 +794,7 @@ def test_botservice_prepare_deploy_javascript_should_fail_with_proj_file_path(se prepare_webapp_deploy(language, code_dir, proj_file_path) raise Exception("'az bot prepare-publish ' should have failed with --proj-file-path") except CLIError as cli_error: - assert cli_error.__str__() == '--proj-file-path should not be passed in if language is not Csharp' + assert (str(cli_error)) == '--proj-file-path should not be passed in if language is not Csharp' except Exception as error: raise error @@ -820,7 +820,7 @@ def test_botservice_prepare_deploy_typescript_should_fail_with_proj_file_path(se prepare_webapp_deploy(language, code_dir, proj_file_path) raise Exception("'az bot prepare-publish --lang Typescript' should have failed with --proj-file-path") except CLIError as cli_error: - assert cli_error.__str__() == '--proj-file-path should not be passed in if language is not Csharp' + assert (str(cli_error)) == '--proj-file-path should not be passed in if language is not Csharp' def test_botservice_prepare_deploy_typescript(self): code_dir = 'node_bot_typescript' @@ -880,7 +880,7 @@ def test_botservice_prepare_deploy_csharp_no_proj_file(self): prepare_webapp_deploy(language, code_dir, proj_file_path) raise Exception("'az bot prepare-publish ' should have failed with no --proj-file-path") except CLIError as cli_error: - assert cli_error.__str__() == '--proj-file-path must be provided if language is Csharp' + assert (str(cli_error)) == '--proj-file-path must be provided if language is Csharp' def test_botservice_prepare_deploy_csharp_fail_if_deployment_file_exists(self): code_dir = 'csharp_bot_deployment' @@ -899,7 +899,7 @@ def test_botservice_prepare_deploy_csharp_fail_if_deployment_file_exists(self): shutil.rmtree(code_dir) except CLIError as cli_error: shutil.rmtree(code_dir) - assert cli_error.__str__() == '.deployment found in csharp_bot_deployment\nPlease delete this .deployment before ' \ + assert (str(cli_error)) == '.deployment found in csharp_bot_deployment\nPlease delete this .deployment before ' \ 'calling "az bot prepare-deploy"' except Exception as error: shutil.rmtree(code_dir) @@ -921,7 +921,7 @@ def test_botservice_prepare_deploy_javascript_fail_if_web_config_exists(self): shutil.rmtree(code_dir) except CLIError as cli_error: shutil.rmtree(code_dir) - assert cli_error.__str__() == 'web.config found in node_bot_web_config\nPlease delete this web.config before ' \ + assert (str(cli_error)) == 'web.config found in node_bot_web_config\nPlease delete this web.config before ' \ 'calling "az bot prepare-deploy"' except Exception as error: shutil.rmtree(code_dir) diff --git a/src/azure-cli/azure/cli/command_modules/containerapp/_utils.py b/src/azure-cli/azure/cli/command_modules/containerapp/_utils.py index 22ea0ab0cc8..0557db93d75 100644 --- a/src/azure-cli/azure/cli/command_modules/containerapp/_utils.py +++ b/src/azure-cli/azure/cli/command_modules/containerapp/_utils.py @@ -1584,7 +1584,7 @@ def set_managed_identity(cmd, resource_group_name, containerapp_def, system_assi containerapp_def["identity"] = {} containerapp_def["identity"]["type"] = "None" - if assign_system_identity and containerapp_def["identity"]["type"].__contains__("SystemAssigned"): + if assign_system_identity and (containerapp_def["identity"]["type"] in "SystemAssigned"): logger.warning("System identity is already assigned to containerapp") # Assign correct type diff --git a/src/azure-cli/azure/cli/command_modules/containerapp/tests/latest/test_containerapp_utils.py b/src/azure-cli/azure/cli/command_modules/containerapp/tests/latest/test_containerapp_utils.py index 7d849f6ccd2..cd7b3e977b9 100644 --- a/src/azure-cli/azure/cli/command_modules/containerapp/tests/latest/test_containerapp_utils.py +++ b/src/azure-cli/azure/cli/command_modules/containerapp/tests/latest/test_containerapp_utils.py @@ -229,7 +229,7 @@ def test_load_cert_file(self): try: blob, thumbprint = load_cert_file(pfx_file, testpassword) except CLIInternalError as e: - self.assertTrue(e.error_msg.error_msg.__contains__('Invalid password or PKCS12 data')) + self.assertTrue(e.error_msg.error_msg in 'Invalid password or PKCS12 data') self.assertEqual('', thumbprint) pfx_file = os.path.join(TEST_DIR, 'data', 'cert2.pfx') diff --git a/src/azure-cli/azure/cli/command_modules/containerapp/tests/latest/utils.py b/src/azure-cli/azure/cli/command_modules/containerapp/tests/latest/utils.py index 1c92c379406..bd8f23d6d5a 100644 --- a/src/azure-cli/azure/cli/command_modules/containerapp/tests/latest/utils.py +++ b/src/azure-cli/azure/cli/command_modules/containerapp/tests/latest/utils.py @@ -17,7 +17,7 @@ def prepare_containerapp_env_for_app_e2e_tests(test_cls): try: managed_env = test_cls.cmd('containerapp env show -g {} -n {}'.format(rg_name, env_name)).get_output_in_json() except CLIInternalError as e: - if e.error_msg.__contains__('ResourceGroupNotFound') or e.error_msg.__contains__('ResourceNotFound'): + if (e.error_msg in 'ResourceGroupNotFound') or (e.error_msg in 'ResourceNotFound'): test_cls.cmd(f'group create -n {rg_name}') test_cls.cmd(f'containerapp env create -g {rg_name} -n {env_name} --logs-destination none') managed_env = test_cls.cmd('containerapp env show -g {} -n {}'.format(rg_name, env_name)).get_output_in_json() diff --git a/src/azure-cli/azure/cli/command_modules/resource/_validators.py b/src/azure-cli/azure/cli/command_modules/resource/_validators.py index 5d0909b53f2..991ce811e00 100644 --- a/src/azure-cli/azure/cli/command_modules/resource/_validators.py +++ b/src/azure-cli/azure/cli/command_modules/resource/_validators.py @@ -63,7 +63,7 @@ def _validate_deployment_name_with_template_specs(namespace): namespace.template_spec = namespace.template_spec.strip("\"") if not is_valid_resource_id(namespace.template_spec): raise CLIError('--template-spec is not a valid resource ID.') - if namespace.template_spec.__contains__("versions") is False: + if (namespace.template_spec in "versions") is False: raise CLIError('Please enter a valid template spec version ID.') template_filename = parse_resource_id(namespace.template_spec).get('resource_name') if template_filename: From 3d9da7eb1b22194b969bfc3b2f60b66602a42f8f Mon Sep 17 00:00:00 2001 From: Hang Lei Date: Mon, 18 Nov 2024 14:57:56 +0800 Subject: [PATCH 2/7] Minor fix --- src/azure-cli/azure/cli/command_modules/resource/_validators.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/azure-cli/azure/cli/command_modules/resource/_validators.py b/src/azure-cli/azure/cli/command_modules/resource/_validators.py index 991ce811e00..d3182642520 100644 --- a/src/azure-cli/azure/cli/command_modules/resource/_validators.py +++ b/src/azure-cli/azure/cli/command_modules/resource/_validators.py @@ -63,7 +63,7 @@ def _validate_deployment_name_with_template_specs(namespace): namespace.template_spec = namespace.template_spec.strip("\"") if not is_valid_resource_id(namespace.template_spec): raise CLIError('--template-spec is not a valid resource ID.') - if (namespace.template_spec in "versions") is False: + if 'versions' not in namespace.template_spec: raise CLIError('Please enter a valid template spec version ID.') template_filename = parse_resource_id(namespace.template_spec).get('resource_name') if template_filename: From 6fa5823227963d79c204c51d8c65eb30accb1be4 Mon Sep 17 00:00:00 2001 From: Hang Date: Thu, 28 Nov 2024 11:14:48 +0800 Subject: [PATCH 3/7] Minor fix --- .../tests/latest/test_bot_commands.py | 18 +++++++++--------- .../tests/latest/test_containerapp_utils.py | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/azure-cli/azure/cli/command_modules/botservice/tests/latest/test_bot_commands.py b/src/azure-cli/azure/cli/command_modules/botservice/tests/latest/test_bot_commands.py index 730721419cb..64168e111af 100644 --- a/src/azure-cli/azure/cli/command_modules/botservice/tests/latest/test_bot_commands.py +++ b/src/azure-cli/azure/cli/command_modules/botservice/tests/latest/test_bot_commands.py @@ -481,7 +481,7 @@ def test_botservice_create_should_raise_error_for_invalid_app_id_args(self, reso self.cmd('az bot create -g {rg} -n {botname} --appid {numbers_id} --app-type MultiTenant') raise AssertionError() except CLIError as cli_error: - assert (str(cli_error)) == expected_error + assert str(cli_error) == expected_error except AssertionError: raise AssertionError('should have thrown an error for appid that is not valid GUID.') @@ -489,7 +489,7 @@ def test_botservice_create_should_raise_error_for_invalid_app_id_args(self, reso self.cmd('az bot create -g {rg} -n {botname} --appid {short_app_id} --app-type MultiTenant') raise AssertionError() except CLIError as cli_error: - assert (str(cli_error)) == expected_error + assert str(cli_error) == expected_error except AssertionError: raise AssertionError('should have thrown an error for appid that is not valid GUID.') @@ -497,7 +497,7 @@ def test_botservice_create_should_raise_error_for_invalid_app_id_args(self, reso self.cmd('az bot create -g {rg} -n {botname} --appid "" --app-type MultiTenant') raise AssertionError() except CLIError as cli_error: - assert (str(cli_error)) == expected_error + assert str(cli_error) == expected_error except AssertionError: raise AssertionError('should have thrown an error for appid that is not valid GUID.') @@ -781,7 +781,7 @@ def test_botservice_prepare_deploy_should_fail_if_code_dir_doesnt_exist(self): raise Exception("'az bot prepare-publish' should have failed with nonexistent --code-dir value") except CLIError as cli_error: print(str(cli_error)) - assert (str(cli_error)) == 'Provided --code-dir value (does_not_exist) does not exist' + assert str(cli_error) == 'Provided --code-dir value (does_not_exist) does not exist' except Exception as error: raise error @@ -794,7 +794,7 @@ def test_botservice_prepare_deploy_javascript_should_fail_with_proj_file_path(se prepare_webapp_deploy(language, code_dir, proj_file_path) raise Exception("'az bot prepare-publish ' should have failed with --proj-file-path") except CLIError as cli_error: - assert (str(cli_error)) == '--proj-file-path should not be passed in if language is not Csharp' + assert str(cli_error) == '--proj-file-path should not be passed in if language is not Csharp' except Exception as error: raise error @@ -820,7 +820,7 @@ def test_botservice_prepare_deploy_typescript_should_fail_with_proj_file_path(se prepare_webapp_deploy(language, code_dir, proj_file_path) raise Exception("'az bot prepare-publish --lang Typescript' should have failed with --proj-file-path") except CLIError as cli_error: - assert (str(cli_error)) == '--proj-file-path should not be passed in if language is not Csharp' + assert str(cli_error) == '--proj-file-path should not be passed in if language is not Csharp' def test_botservice_prepare_deploy_typescript(self): code_dir = 'node_bot_typescript' @@ -880,7 +880,7 @@ def test_botservice_prepare_deploy_csharp_no_proj_file(self): prepare_webapp_deploy(language, code_dir, proj_file_path) raise Exception("'az bot prepare-publish ' should have failed with no --proj-file-path") except CLIError as cli_error: - assert (str(cli_error)) == '--proj-file-path must be provided if language is Csharp' + assert str(cli_error) == '--proj-file-path must be provided if language is Csharp' def test_botservice_prepare_deploy_csharp_fail_if_deployment_file_exists(self): code_dir = 'csharp_bot_deployment' @@ -899,7 +899,7 @@ def test_botservice_prepare_deploy_csharp_fail_if_deployment_file_exists(self): shutil.rmtree(code_dir) except CLIError as cli_error: shutil.rmtree(code_dir) - assert (str(cli_error)) == '.deployment found in csharp_bot_deployment\nPlease delete this .deployment before ' \ + assert str(cli_error) == '.deployment found in csharp_bot_deployment\nPlease delete this .deployment before ' \ 'calling "az bot prepare-deploy"' except Exception as error: shutil.rmtree(code_dir) @@ -921,7 +921,7 @@ def test_botservice_prepare_deploy_javascript_fail_if_web_config_exists(self): shutil.rmtree(code_dir) except CLIError as cli_error: shutil.rmtree(code_dir) - assert (str(cli_error)) == 'web.config found in node_bot_web_config\nPlease delete this web.config before ' \ + assert str(cli_error) == 'web.config found in node_bot_web_config\nPlease delete this web.config before ' \ 'calling "az bot prepare-deploy"' except Exception as error: shutil.rmtree(code_dir) diff --git a/src/azure-cli/azure/cli/command_modules/containerapp/tests/latest/test_containerapp_utils.py b/src/azure-cli/azure/cli/command_modules/containerapp/tests/latest/test_containerapp_utils.py index cd7b3e977b9..16641e3e569 100644 --- a/src/azure-cli/azure/cli/command_modules/containerapp/tests/latest/test_containerapp_utils.py +++ b/src/azure-cli/azure/cli/command_modules/containerapp/tests/latest/test_containerapp_utils.py @@ -229,7 +229,7 @@ def test_load_cert_file(self): try: blob, thumbprint = load_cert_file(pfx_file, testpassword) except CLIInternalError as e: - self.assertTrue(e.error_msg.error_msg in 'Invalid password or PKCS12 data') + self.assertIn('Invalid password or PKCS12 data', e.error_msg.error_msg) self.assertEqual('', thumbprint) pfx_file = os.path.join(TEST_DIR, 'data', 'cert2.pfx') From c0349f0aeba191d759c42bcdaef7799853fc373d Mon Sep 17 00:00:00 2001 From: Hang Date: Thu, 28 Nov 2024 13:50:49 +0800 Subject: [PATCH 4/7] Minor fix --- src/azure-cli-core/azure/cli/core/telemetry.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/azure-cli-core/azure/cli/core/telemetry.py b/src/azure-cli-core/azure/cli/core/telemetry.py index bf90048b589..002efba6435 100644 --- a/src/azure-cli-core/azure/cli/core/telemetry.py +++ b/src/azure-cli-core/azure/cli/core/telemetry.py @@ -316,7 +316,7 @@ def flush(): save(get_config_dir(), _session.generate_payload()) # reset session fields, retaining correlation id and application - _session.__init__(correlation_id=_session.correlation_id, application=_session.application) + _session.__init__(correlation_id=_session.correlation_id, application=_session.application) # pylint: disable=unnecessary-dunder-call @_user_agrees_to_telemetry From 05b75056dc6cfa1b55bb45ea80cbe52d3eb9bb42 Mon Sep 17 00:00:00 2001 From: Hang Date: Thu, 28 Nov 2024 14:52:35 +0800 Subject: [PATCH 5/7] Remove delete_lb_resource_property_entry --- .../network/azure_stack/_util.py | 34 ------------------- 1 file changed, 34 deletions(-) diff --git a/src/azure-cli/azure/cli/command_modules/network/azure_stack/_util.py b/src/azure-cli/azure/cli/command_modules/network/azure_stack/_util.py index 0562404a6ee..4a14a5bd554 100644 --- a/src/azure-cli/azure/cli/command_modules/network/azure_stack/_util.py +++ b/src/azure-cli/azure/cli/command_modules/network/azure_stack/_util.py @@ -3,43 +3,9 @@ # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------------------------------- -import sys -from knack.util import CLIError -from azure.cli.core.util import sdk_no_wait - -from ._client_factory import network_client_factory -from .custom import lb_get from azure.cli.core.azclierror import UnrecognizedArgumentError -# workaround for : https://github.com/Azure/azure-cli/issues/17071 -def delete_lb_resource_property_entry(resource, prop): - """ Factory method for creating delete functions. """ - - def delete_func(cmd, resource_group_name, resource_name, item_name, no_wait=False): # pylint: disable=unused-argument - client = getattr(network_client_factory(cmd.cli_ctx), resource) - item = lb_get(client, resource_group_name, resource_name) - - if item.__getattribute__(prop) is not None: - keep_items = [x for x in item.__getattribute__(prop) if x.name.lower() != item_name.lower()] - else: - keep_items = None - - with cmd.update_context(item) as c: - c.set_param(prop, keep_items) - if no_wait: - sdk_no_wait(no_wait, client.begin_create_or_update, resource_group_name, resource_name, item) - else: - result = sdk_no_wait(no_wait, client.begin_create_or_update, - resource_group_name, resource_name, item).result() - if next((x for x in getattr(result, prop) or [] if x.name.lower() == item_name.lower()), None): - raise CLIError("Failed to delete '{}' on '{}'".format(item_name, resource_name)) - - func_name = 'delete_lb_resource_property_entry_{}_{}'.format(resource, prop) - setattr(sys.modules[__name__], func_name, delete_func) - return func_name - - def _list_to_dict(enum_list): return {item.lower(): item for item in enum_list} From 14dcb01f73a547942990d9ee9eda56626ff759ca Mon Sep 17 00:00:00 2001 From: Hang Date: Fri, 29 Nov 2024 17:10:03 +0800 Subject: [PATCH 6/7] Apply suggestions from code review Co-authored-by: Jiashuo Li <4003950+jiasli@users.noreply.github.com> --- src/azure-cli/azure/cli/command_modules/containerapp/_utils.py | 2 +- .../cli/command_modules/containerapp/tests/latest/utils.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/azure-cli/azure/cli/command_modules/containerapp/_utils.py b/src/azure-cli/azure/cli/command_modules/containerapp/_utils.py index f10222af235..d8711d4cf03 100644 --- a/src/azure-cli/azure/cli/command_modules/containerapp/_utils.py +++ b/src/azure-cli/azure/cli/command_modules/containerapp/_utils.py @@ -1584,7 +1584,7 @@ def set_managed_identity(cmd, resource_group_name, containerapp_def, system_assi containerapp_def["identity"] = {} containerapp_def["identity"]["type"] = "None" - if assign_system_identity and (containerapp_def["identity"]["type"] in "SystemAssigned"): + if assign_system_identity and "SystemAssigned" in containerapp_def["identity"]["type"]: logger.warning("System identity is already assigned to containerapp") # Assign correct type diff --git a/src/azure-cli/azure/cli/command_modules/containerapp/tests/latest/utils.py b/src/azure-cli/azure/cli/command_modules/containerapp/tests/latest/utils.py index bd8f23d6d5a..d3d7471de18 100644 --- a/src/azure-cli/azure/cli/command_modules/containerapp/tests/latest/utils.py +++ b/src/azure-cli/azure/cli/command_modules/containerapp/tests/latest/utils.py @@ -17,7 +17,7 @@ def prepare_containerapp_env_for_app_e2e_tests(test_cls): try: managed_env = test_cls.cmd('containerapp env show -g {} -n {}'.format(rg_name, env_name)).get_output_in_json() except CLIInternalError as e: - if (e.error_msg in 'ResourceGroupNotFound') or (e.error_msg in 'ResourceNotFound'): + if 'ResourceGroupNotFound' in e.error_msg or 'ResourceNotFound' in e.error_msg: test_cls.cmd(f'group create -n {rg_name}') test_cls.cmd(f'containerapp env create -g {rg_name} -n {env_name} --logs-destination none') managed_env = test_cls.cmd('containerapp env show -g {} -n {}'.format(rg_name, env_name)).get_output_in_json() From ea8fc765854d8478b5f509c3030575fc0386a919 Mon Sep 17 00:00:00 2001 From: Hang Date: Tue, 3 Dec 2024 14:59:49 +0800 Subject: [PATCH 7/7] Update scripts/live_test/generate_index.py --- scripts/live_test/generate_index.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/live_test/generate_index.py b/scripts/live_test/generate_index.py index fef6692b5a4..97b47f1fa74 100644 --- a/scripts/live_test/generate_index.py +++ b/scripts/live_test/generate_index.py @@ -177,7 +177,7 @@ def render(data, container, container_url, testdata, USER_REPO, USER_BRANCH, COM # elif 'sequential' in name: # display_name = 'sequential' try: - html = str(requests.get(url).content) + html = requests.get(url).text pattern = re.compile('\\d+ tests ran in') match = pattern.search(html) number = match.group().split()[0]