Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 3 additions & 9 deletions python_files/unittestadapter/execution.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,22 +284,21 @@ def send_run_data(raw_data, test_run_pipe):
run_test_ids_pipe = os.environ.get("RUN_TEST_IDS_PIPE")
test_run_pipe = os.getenv("TEST_RUN_PIPE")
if not run_test_ids_pipe:
print("Error[vscode-unittest]: RUN_TEST_IDS_PIPE env var is not set.")
print("Error[vscode-unittest]: RUN_TEST_IDS_PIPE env var is not set.", file=sys.stderr)
raise VSCodeUnittestError("Error[vscode-unittest]: RUN_TEST_IDS_PIPE env var is not set.")
if not test_run_pipe:
print("Error[vscode-unittest]: TEST_RUN_PIPE env var is not set.")
print("Error[vscode-unittest]: TEST_RUN_PIPE env var is not set.", file=sys.stderr)
raise VSCodeUnittestError("Error[vscode-unittest]: TEST_RUN_PIPE env var is not set.")
test_ids = []
cwd = pathlib.Path(start_dir).absolute()
try:
# Read the test ids from the file, attempt to delete file afterwords.
ids_path = pathlib.Path(run_test_ids_pipe)
test_ids = ids_path.read_text(encoding="utf-8").splitlines()
print("Received test ids from temp file.")
try:
ids_path.unlink()
except Exception as e:
print("Error[vscode-pytest]: unable to delete temp file" + str(e))
print(f"Error[vscode-unittest]: unable to delete temp file: {e}", file=sys.stderr)

except Exception as e:
# No test ids received from buffer, return error payload
Expand All @@ -318,10 +317,6 @@ def send_run_data(raw_data, test_run_pipe):
is_coverage_run = os.environ.get("COVERAGE_ENABLED") is not None
include_branches = False
if is_coverage_run:
print(
"COVERAGE_ENABLED env var set, starting coverage. workspace_root used as parent dir:",
workspace_root,
)
import coverage

# insert "python_files/lib/python" into the path so packaging can be imported
Expand Down Expand Up @@ -350,7 +345,6 @@ def send_run_data(raw_data, test_run_pipe):

# If no error occurred, we will have test ids to run.
if manage_py_path := os.environ.get("MANAGE_PY_PATH"):
print("MANAGE_PY_PATH env var set, running Django test suite.")
args = argv[index + 1 :] or []
django_execution_runner(manage_py_path, test_ids, args)
else:
Expand Down