diff --git a/tests/platform_tests/test_platform_info.py b/tests/platform_tests/test_platform_info.py index b8740e1a4ce..3cbdc5a3058 100644 --- a/tests/platform_tests/test_platform_info.py +++ b/tests/platform_tests/test_platform_info.py @@ -292,9 +292,9 @@ def check_thermal_control_load_invalid_file(duthost, file_name): control daemon is up and there is an error log printed """ loganalyzer = LogAnalyzer(ansible_host=duthost, marker_prefix='thermal_control') - with ThermalPolicyFileContext(duthost, file_name): - loganalyzer.expect_regex = [LOG_EXPECT_POLICY_FILE_INVALID] - with loganalyzer: + loganalyzer.expect_regex = [LOG_EXPECT_POLICY_FILE_INVALID] + with loganalyzer: + with ThermalPolicyFileContext(duthost, file_name): restart_thermal_control_daemon(duthost)