Skip to content

Commit d5500a5

Browse files
authored
fix pytest run script to add cwd to path (#21399)
fixes #21397. The issue came from the setup of running a script that then runs pytest which is different then pytest discovery which runs pytest as a module. The run script didn't work since the script did not insert the cwd into the path like what is done when running a module. This change inserts the cwd.
1 parent 3e5af44 commit d5500a5

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

pythonFiles/vscode_pytest/run_pytest_script.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
# Add the root directory to the path so that we can import the plugin.
2222
directory_path = pathlib.Path(__file__).parent.parent
2323
sys.path.append(os.fspath(directory_path))
24+
sys.path.insert(0, os.getcwd())
2425
# Get the rest of the args to run with pytest.
2526
args = sys.argv[1:]
2627
run_test_ids_port = os.environ.get("RUN_TEST_IDS_PORT")

0 commit comments

Comments
 (0)