Skip to content

Commit 544fd7a

Browse files
authored
Merge pull request #1476 from codeflash-ai/fix-crosshair-pythonpath
Fix CrossHair subprocess missing PYTHONPATH
2 parents bcffb5e + c0de087 commit 544fd7a

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

codeflash/verification/concolic_testing.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from __future__ import annotations
22

33
import ast
4+
import os
45
import subprocess
56
import tempfile
67
import time
@@ -63,6 +64,13 @@ def generate_concolic_tests(
6364
logger.info("Generating concolic opcode coverage tests for the original code…")
6465
console.rule()
6566
try:
67+
env = os.environ.copy()
68+
pythonpath = env.get("PYTHONPATH", "")
69+
project_root_str = str(args.project_root)
70+
if pythonpath:
71+
env["PYTHONPATH"] = f"{project_root_str}{os.pathsep}{pythonpath}"
72+
else:
73+
env["PYTHONPATH"] = project_root_str
6674
cover_result = subprocess.run(
6775
[
6876
SAFE_SYS_EXECUTABLE,
@@ -86,6 +94,7 @@ def generate_concolic_tests(
8694
cwd=args.project_root,
8795
check=False,
8896
timeout=600,
97+
env=env,
8998
)
9099
except subprocess.TimeoutExpired:
91100
logger.debug("CrossHair Cover test generation timed out")

0 commit comments

Comments
 (0)