Skip to content

Commit

Permalink
fix no test id provided for pytest run (#22569)
Browse files Browse the repository at this point in the history
fixes #22567

Now if a user tries to click the "run" button a empty folder (ie a
folder with no tests in it) it will just run pytest with no testIds as
args and notify the user.
  • Loading branch information
eleanorjboyd committed Nov 29, 2023
1 parent 61fcf3a commit e1b54d0
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pythonFiles/vscode_pytest/run_pytest_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,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")

0 comments on commit e1b54d0

Please sign in to comment.