diff --git a/python_files/tests/pytestadapter/test_discovery.py b/python_files/tests/pytestadapter/test_discovery.py index 276753149410..0f6f6bf5382d 100644 --- a/python_files/tests/pytestadapter/test_discovery.py +++ b/python_files/tests/pytestadapter/test_discovery.py @@ -195,15 +195,17 @@ def test_pytest_collect(file, expected_const): if actual_list is not None: actual_item = actual_list.pop(0) assert all(item in actual_item for item in ("status", "cwd", "error")) - assert ( - actual_item.get("status") == "success" - ), f"Status is not 'success', error is: {actual_item.get('error')}" + assert actual_item.get("status") == "success", ( + f"Status is not 'success', error is: {actual_item.get('error')}" + ) assert actual_item.get("cwd") == os.fspath(helpers.TEST_DATA_PATH) assert is_same_tree( actual_item.get("tests"), expected_const, ["id_", "lineno", "name", "runID"], - ), f"Tests tree does not match expected value. \n Expected: {json.dumps(expected_const, indent=4)}. \n Actual: {json.dumps(actual_item.get('tests'), indent=4)}" + ), ( + f"Tests tree does not match expected value. \n Expected: {json.dumps(expected_const, indent=4)}. \n Actual: {json.dumps(actual_item.get('tests'), indent=4)}" + ) @pytest.mark.skipif( @@ -232,13 +234,13 @@ def test_symlink_root_dir(): actual_item = actual_list.pop(0) try: # Check if all requirements - assert all( - item in actual_item for item in ("status", "cwd", "error") - ), "Required keys are missing" + assert all(item in actual_item for item in ("status", "cwd", "error")), ( + "Required keys are missing" + ) assert actual_item.get("status") == "success", "Status is not 'success'" - assert actual_item.get("cwd") == os.fspath( - destination - ), f"CWD does not match: {os.fspath(destination)}" + assert actual_item.get("cwd") == os.fspath(destination), ( + f"CWD does not match: {os.fspath(destination)}" + ) assert actual_item.get("tests") == expected, "Tests do not match expected value" except AssertionError as e: # Print the actual_item in JSON format if an assertion fails @@ -271,7 +273,9 @@ def test_pytest_root_dir(): actual_item.get("tests"), expected_discovery_test_output.root_with_config_expected_output, ["id_", "lineno", "name", "runID"], - ), f"Tests tree does not match expected value. \n Expected: {json.dumps(expected_discovery_test_output.root_with_config_expected_output, indent=4)}. \n Actual: {json.dumps(actual_item.get('tests'), indent=4)}" + ), ( + f"Tests tree does not match expected value. \n Expected: {json.dumps(expected_discovery_test_output.root_with_config_expected_output, indent=4)}. \n Actual: {json.dumps(actual_item.get('tests'), indent=4)}" + ) def test_pytest_config_file(): @@ -298,7 +302,9 @@ def test_pytest_config_file(): actual_item.get("tests"), expected_discovery_test_output.root_with_config_expected_output, ["id_", "lineno", "name", "runID"], - ), f"Tests tree does not match expected value. \n Expected: {json.dumps(expected_discovery_test_output.root_with_config_expected_output, indent=4)}. \n Actual: {json.dumps(actual_item.get('tests'), indent=4)}" + ), ( + f"Tests tree does not match expected value. \n Expected: {json.dumps(expected_discovery_test_output.root_with_config_expected_output, indent=4)}. \n Actual: {json.dumps(actual_item.get('tests'), indent=4)}" + ) def test_config_sub_folder(): diff --git a/python_files/tests/pytestadapter/test_execution.py b/python_files/tests/pytestadapter/test_execution.py index 27fd1160441b..95a66e0e7b87 100644 --- a/python_files/tests/pytestadapter/test_execution.py +++ b/python_files/tests/pytestadapter/test_execution.py @@ -258,13 +258,13 @@ def test_symlink_run(): actual_item = actual_list.pop(0) try: # Check if all requirements - assert all( - item in actual_item for item in ("status", "cwd", "result") - ), "Required keys are missing" + assert all(item in actual_item for item in ("status", "cwd", "result")), ( + "Required keys are missing" + ) assert actual_item.get("status") == "success", "Status is not 'success'" - assert actual_item.get("cwd") == os.fspath( - destination - ), f"CWD does not match: {os.fspath(destination)}" + assert actual_item.get("cwd") == os.fspath(destination), ( + f"CWD does not match: {os.fspath(destination)}" + ) actual_result_dict = {} actual_result_dict.update(actual_item["result"]) assert actual_result_dict == expected_const diff --git a/python_files/tests/unittestadapter/test_discovery.py b/python_files/tests/unittestadapter/test_discovery.py index 972556de999b..a10b5c406680 100644 --- a/python_files/tests/unittestadapter/test_discovery.py +++ b/python_files/tests/unittestadapter/test_discovery.py @@ -314,9 +314,9 @@ def test_simple_django_collect(): if actual_list is not None: actual_item = actual_list.pop(0) assert all(item in actual_item for item in ("status", "cwd")) - assert ( - actual_item.get("status") == "success" - ), f"Status is not 'success', error is: {actual_item.get('error')}" + assert actual_item.get("status") == "success", ( + f"Status is not 'success', error is: {actual_item.get('error')}" + ) assert actual_item.get("cwd") == os.fspath(data_path) assert len(actual_item["tests"]["children"]) == 1 assert actual_item["tests"]["children"][0]["children"][0]["id_"] == os.fsdecode(