From 1639753185a54a50f142068d26d2f2e5a3690488 Mon Sep 17 00:00:00 2001 From: Eleanor Boyd Date: Mon, 27 Nov 2023 13:29:49 -0800 Subject: [PATCH] switch to conditional error message on check for UUID and port during pytest config (#22534) fixes https://github.com/microsoft/vscode-python/issues/19857 --- pythonFiles/vscode_pytest/__init__.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/pythonFiles/vscode_pytest/__init__.py b/pythonFiles/vscode_pytest/__init__.py index 6f5687357f1d..51c5e5e14fda 100644 --- a/pythonFiles/vscode_pytest/__init__.py +++ b/pythonFiles/vscode_pytest/__init__.py @@ -64,12 +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") - 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 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