Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
test: move pysr test to integration folder
  • Loading branch information
MilesCranmer committed Aug 23, 2024
commit c0dcd736467a497a2f083b0a7bb96c0c84f3306e
45 changes: 45 additions & 0 deletions pytest/integration/pysr.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
def test_integration_pysr():
"Integration tests for PySR"
import os
import platform
import subprocess
import sys
import tempfile

with tempfile.TemporaryDirectory() as tempdir:
subprocess.run([sys.executable, "-m", "virtualenv", tempdir], check=True)

virtualenv_path = os.path.join(
tempdir, "Scripts" if platform.system() == "Windows" else "bin"
)
virtualenv_executable = os.path.join(virtualenv_path, "python")

assert os.path.exists(virtualenv_executable)

# Install this package
subprocess.run([virtualenv_executable, "-m", "pip", "install", "."], check=True)
# Install PySR with no requirement on JuliaCall
subprocess.run(
[virtualenv_executable, "-m", "pip", "install", "--no-deps", "pysr"],
check=True,
)
# Install PySR test requirements
subprocess.run(
[
virtualenv_executable,
"-m",
"pip",
"install",
"sympy",
"pandas",
"scikit_learn",
"click",
"setuptools",
"pytest",
],
check=True,
)
# Run PySR main test suite
subprocess.run(
[virtualenv_executable, "-m", "pysr", "test", "main"], check=True
)
49 changes: 0 additions & 49 deletions pytest/test_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,52 +164,3 @@ def test_call_nogil(yld, raw):
t2 = time() - t0
# executing the tasks should take about 1 second because they happen in parallel
assert 0.9 < t2 < 1.5


def test_integration_pysr():
"Integration tests for PySR"
import os
import platform
import subprocess
import sys
import tempfile

with tempfile.TemporaryDirectory() as tempdir:
subprocess.run([sys.executable, "-m", "virtualenv", tempdir], check=True)

virtualenv_path = os.path.join(
tempdir, "Scripts" if platform.system() == "Windows" else "bin"
)
virtualenv_executable = os.path.join(virtualenv_path, "python")

assert os.path.exists(virtualenv_executable)

# Install this package
subprocess.run([virtualenv_executable, "-m", "pip", "install", "."], check=True)
# Install PySR with no requirement on JuliaCall
subprocess.run(
[virtualenv_executable, "-m", "pip", "install", "--no-deps", "pysr"],
check=True,
)
# Install PySR test requirements
subprocess.run(
[
virtualenv_executable,
"-m",
"pip",
"install",
"sympy",
"pandas",
"scikit_learn",
"click",
"setuptools",
"typing_extensions",
"pytest",
"nbval",
],
check=True,
)
# Run PySR main test suite
subprocess.run(
[virtualenv_executable, "-m", "pysr", "test", "main"], check=True
)