From cb64bc424c84dbcd8a90eaa9e38e27d53ce586fb Mon Sep 17 00:00:00 2001 From: eleanorjboyd Date: Wed, 29 Nov 2023 11:56:20 -0800 Subject: [PATCH 1/2] fix no test id provided for pytest run --- pythonFiles/vscode_pytest/run_pytest_script.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/pythonFiles/vscode_pytest/run_pytest_script.py b/pythonFiles/vscode_pytest/run_pytest_script.py index e60ee91f096e..562a66951eb3 100644 --- a/pythonFiles/vscode_pytest/run_pytest_script.py +++ b/pythonFiles/vscode_pytest/run_pytest_script.py @@ -19,6 +19,7 @@ if __name__ == "__main__": # Add the root directory to the path so that we can import the plugin. + print("HERE, in the run_pytest_script.py") directory_path = pathlib.Path(__file__).parent.parent sys.path.append(os.fspath(directory_path)) sys.path.insert(0, os.getcwd()) @@ -53,7 +54,7 @@ ) # Clear the buffer as complete JSON object is received buffer = b"" - print("Received JSON data in run script") + print("Received JSON data in run script, 2") break except json.JSONDecodeError: # JSON decoding error, the complete JSON object is not yet received @@ -64,6 +65,14 @@ try: if test_ids_from_buffer: arg_array = ["-p", "vscode_pytest"] + args + test_ids_from_buffer + print("Running pytest with args: " + str(arg_array)) + pytest.main(arg_array) + else: + print( + "Error: No test ids received from stdin, could be an error or a run request without ids provided.", + ) + print("Running pytest with no test ids as args. Args being used: ", args) + arg_array = ["-p", "vscode_pytest"] + args pytest.main(arg_array) except json.JSONDecodeError: print("Error: Could not parse test ids from stdin") From 94b6cc7a51a422255c005a79fe6a3f8e41b841a6 Mon Sep 17 00:00:00 2001 From: eleanorjboyd Date: Wed, 29 Nov 2023 12:06:10 -0800 Subject: [PATCH 2/2] remove debugging print statements --- pythonFiles/vscode_pytest/run_pytest_script.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pythonFiles/vscode_pytest/run_pytest_script.py b/pythonFiles/vscode_pytest/run_pytest_script.py index 562a66951eb3..8005f3a32c0e 100644 --- a/pythonFiles/vscode_pytest/run_pytest_script.py +++ b/pythonFiles/vscode_pytest/run_pytest_script.py @@ -19,7 +19,6 @@ if __name__ == "__main__": # Add the root directory to the path so that we can import the plugin. - print("HERE, in the run_pytest_script.py") directory_path = pathlib.Path(__file__).parent.parent sys.path.append(os.fspath(directory_path)) sys.path.insert(0, os.getcwd()) @@ -54,7 +53,7 @@ ) # Clear the buffer as complete JSON object is received buffer = b"" - print("Received JSON data in run script, 2") + print("Received JSON data in run script") break except json.JSONDecodeError: # JSON decoding error, the complete JSON object is not yet received