From 98592c231fce86a23400128c6372bd45637c7dbf Mon Sep 17 00:00:00 2001 From: eleanorjboyd Date: Mon, 27 Nov 2023 10:53:31 -0800 Subject: [PATCH 1/2] remove constant error message in pytest --- pythonFiles/vscode_pytest/__init__.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/pythonFiles/vscode_pytest/__init__.py b/pythonFiles/vscode_pytest/__init__.py index 6f5687357f1d..5b34813f7434 100644 --- a/pythonFiles/vscode_pytest/__init__.py +++ b/pythonFiles/vscode_pytest/__init__.py @@ -64,12 +64,6 @@ def pytest_load_initial_conftests(early_config, parser, args): global TEST_UUID TEST_PORT = os.getenv("TEST_PORT") TEST_UUID = os.getenv("TEST_UUID") - error_string = ( - "PYTEST ERROR: TEST_UUID and/or TEST_PORT are not set at the time of pytest starting. Please confirm these environment variables are not being" - " changed or removed as they are required for successful test discovery and execution." - f" \nTEST_UUID = {TEST_UUID}\nTEST_PORT = {TEST_PORT}\n" - ) - print(error_string, file=sys.stderr) if "--collect-only" in args: global IS_DISCOVERY IS_DISCOVERY = True From c9e05523d20d05e155252d95bf18d59bbd1a1c23 Mon Sep 17 00:00:00 2001 From: eleanorjboyd Date: Mon, 27 Nov 2023 10:55:53 -0800 Subject: [PATCH 2/2] move error message under conditional --- pythonFiles/vscode_pytest/__init__.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pythonFiles/vscode_pytest/__init__.py b/pythonFiles/vscode_pytest/__init__.py index 5b34813f7434..51c5e5e14fda 100644 --- a/pythonFiles/vscode_pytest/__init__.py +++ b/pythonFiles/vscode_pytest/__init__.py @@ -64,6 +64,13 @@ def pytest_load_initial_conftests(early_config, parser, args): global TEST_UUID TEST_PORT = os.getenv("TEST_PORT") TEST_UUID = os.getenv("TEST_UUID") + if TEST_UUID is None or TEST_PORT is None: + error_string = ( + "PYTEST ERROR: TEST_UUID and/or TEST_PORT are not set at the time of pytest starting. Please confirm these environment variables are not being" + " changed or removed as they are required for successful test discovery and execution." + f" \nTEST_UUID = {TEST_UUID}\nTEST_PORT = {TEST_PORT}\n" + ) + print(error_string, file=sys.stderr) if "--collect-only" in args: global IS_DISCOVERY IS_DISCOVERY = True