Skip to content

Commit 319b7f0

Browse files
committed
Update test_runner.py
1 parent 0f64772 commit 319b7f0

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

codeflash/verification/test_runner.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,10 @@ def run_behavioral_tests(
4949
)
5050
else:
5151
test_files.append(str(file.instrumented_behavior_file_path))
52-
pytest_cmd_list = shlex.split(
53-
f"{SAFE_SYS_EXECUTABLE} -m pytest" if pytest_cmd == "pytest" else pytest_cmd, posix=IS_POSIX
52+
pytest_cmd_list = (
53+
shlex.split(f"{SAFE_SYS_EXECUTABLE} -m pytest", posix=IS_POSIX)
54+
if pytest_cmd == "pytest"
55+
else [SAFE_SYS_EXECUTABLE, "-m", *shlex.split(pytest_cmd, posix=IS_POSIX)]
5456
)
5557
test_files = list(set(test_files)) # remove multiple calls in the same test function
5658
common_pytest_args = [
@@ -77,15 +79,15 @@ def run_behavioral_tests(
7779
) # this cleanup is necessary to avoid coverage data from previous runs, if there are any,
7880
# then the current run will be appended to the previous data, which skews the results
7981
logger.debug(cov_erase)
82+
coverage_cmd = [SAFE_SYS_EXECUTABLE, "-m", "coverage", "run", f"--rcfile={coveragercfile.as_posix()}", "-m"]
83+
84+
if pytest_cmd == "pytest":
85+
coverage_cmd.extend(["pytest"])
86+
else:
87+
coverage_cmd.extend(shlex.split(pytest_cmd, posix=IS_POSIX)[1:])
8088

8189
results = execute_test_subprocess(
82-
shlex.split(f"{SAFE_SYS_EXECUTABLE} -m coverage run --rcfile={coveragercfile.as_posix()} -m pytest")
83-
+ common_pytest_args
84-
+ result_args
85-
+ test_files,
86-
cwd=cwd,
87-
env=pytest_test_env,
88-
timeout=600,
90+
coverage_cmd + common_pytest_args + result_args + test_files, cwd=cwd, env=pytest_test_env, timeout=600
8991
)
9092
logger.debug(
9193
f"""Result return code: {results.returncode}, {"Result stderr:" + str(results.stderr) if results.stderr else ""}"""

0 commit comments

Comments
 (0)