Skip to content

Commit 977296d

Browse files
committed
Use correct python executable for virtualenv
1 parent 5f5d3f4 commit 977296d

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

pytest/test_all.py

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,22 +21,33 @@ def test_issue_394():
2121

2222
def test_integration_pysr():
2323
"Integration tests for PySR"
24+
import os
25+
import platform
2426
import subprocess
2527
import sys
2628
import tempfile
2729

2830
with tempfile.TemporaryDirectory() as tempdir:
2931
subprocess.run([sys.executable, "-m", "virtualenv", tempdir], check=True)
32+
33+
virtualenv_path = os.path.join(
34+
tempdir, "Scripts" if platform.system() == "Windows" else "bin"
35+
)
36+
virtualenv_executable = os.path.join(virtualenv_path, "python")
37+
38+
assert os.path.exists(virtualenv_executable)
39+
3040
# Install this package
31-
subprocess.run([sys.executable, "-m", "pip", "install", "."], check=True)
41+
subprocess.run([virtualenv_executable, "-m", "pip", "install", "."], check=True)
3242
# Install PySR with no requirement on JuliaCall
3343
subprocess.run(
34-
[sys.executable, "-m", "pip", "install", "--no-deps", "pysr"], check=True
44+
[virtualenv_executable, "-m", "pip", "install", "--no-deps", "pysr"],
45+
check=True,
3546
)
3647
# Install PySR test requirements
3748
subprocess.run(
3849
[
39-
sys.executable,
50+
virtualenv_executable,
4051
"-m",
4152
"pip",
4253
"install",
@@ -52,4 +63,6 @@ def test_integration_pysr():
5263
check=True,
5364
)
5465
# Run PySR main test suite
55-
subprocess.run([sys.executable, "-m", "pysr", "test", "main"], check=True)
66+
subprocess.run(
67+
[virtualenv_executable, "-m", "pysr", "test", "main"], check=True
68+
)

0 commit comments

Comments
 (0)