Skip to content

Commit 1639753

Browse files
authored
switch to conditional error message on check for UUID and port during pytest config (#22534)
fixes #19857
1 parent 9a5363c commit 1639753

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

pythonFiles/vscode_pytest/__init__.py

+7-6
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,13 @@ def pytest_load_initial_conftests(early_config, parser, args):
6464
global TEST_UUID
6565
TEST_PORT = os.getenv("TEST_PORT")
6666
TEST_UUID = os.getenv("TEST_UUID")
67-
error_string = (
68-
"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"
69-
" changed or removed as they are required for successful test discovery and execution."
70-
f" \nTEST_UUID = {TEST_UUID}\nTEST_PORT = {TEST_PORT}\n"
71-
)
72-
print(error_string, file=sys.stderr)
67+
if TEST_UUID is None or TEST_PORT is None:
68+
error_string = (
69+
"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"
70+
" changed or removed as they are required for successful test discovery and execution."
71+
f" \nTEST_UUID = {TEST_UUID}\nTEST_PORT = {TEST_PORT}\n"
72+
)
73+
print(error_string, file=sys.stderr)
7374
if "--collect-only" in args:
7475
global IS_DISCOVERY
7576
IS_DISCOVERY = True

0 commit comments

Comments
 (0)