Spaces:
Running
Running
MilesCranmer
commited on
Commit
•
603c5f4
1
Parent(s):
c48a68e
Use correct python for subprocess
Browse files- .coveragerc +1 -0
- pysr/test/test_startup.py +6 -2
.coveragerc
CHANGED
@@ -1,3 +1,4 @@
|
|
1 |
[run]
|
2 |
omit =
|
3 |
*/test/*
|
|
|
|
1 |
[run]
|
2 |
omit =
|
3 |
*/test/*
|
4 |
+
source = pysr
|
pysr/test/test_startup.py
CHANGED
@@ -1,4 +1,6 @@
|
|
|
|
1 |
import subprocess
|
|
|
2 |
import tempfile
|
3 |
import textwrap
|
4 |
import unittest
|
@@ -57,7 +59,7 @@ class TestStartup(unittest.TestCase):
|
|
57 |
# Now, create a new process and warm start from the file:
|
58 |
result = subprocess.run(
|
59 |
[
|
60 |
-
|
61 |
"-c",
|
62 |
textwrap.dedent(
|
63 |
f"""
|
@@ -91,6 +93,7 @@ class TestStartup(unittest.TestCase):
|
|
91 |
],
|
92 |
stdout=subprocess.PIPE,
|
93 |
stderr=subprocess.PIPE,
|
|
|
94 |
)
|
95 |
self.assertEqual(result.returncode, 0)
|
96 |
self.assertIn("Loading model from file", result.stdout.decode())
|
@@ -117,9 +120,10 @@ class TestStartup(unittest.TestCase):
|
|
117 |
]
|
118 |
for warning_test in warning_tests:
|
119 |
result = subprocess.run(
|
120 |
-
[
|
121 |
stdout=subprocess.PIPE,
|
122 |
stderr=subprocess.PIPE,
|
|
|
123 |
)
|
124 |
self.assertIn(warning_test["msg"], result.stderr.decode())
|
125 |
|
|
|
1 |
+
import os
|
2 |
import subprocess
|
3 |
+
import sys
|
4 |
import tempfile
|
5 |
import textwrap
|
6 |
import unittest
|
|
|
59 |
# Now, create a new process and warm start from the file:
|
60 |
result = subprocess.run(
|
61 |
[
|
62 |
+
sys.executable,
|
63 |
"-c",
|
64 |
textwrap.dedent(
|
65 |
f"""
|
|
|
93 |
],
|
94 |
stdout=subprocess.PIPE,
|
95 |
stderr=subprocess.PIPE,
|
96 |
+
env=os.environ,
|
97 |
)
|
98 |
self.assertEqual(result.returncode, 0)
|
99 |
self.assertIn("Loading model from file", result.stdout.decode())
|
|
|
120 |
]
|
121 |
for warning_test in warning_tests:
|
122 |
result = subprocess.run(
|
123 |
+
[sys.executable, "-c", warning_test["code"]],
|
124 |
stdout=subprocess.PIPE,
|
125 |
stderr=subprocess.PIPE,
|
126 |
+
env=os.environ,
|
127 |
)
|
128 |
self.assertIn(warning_test["msg"], result.stderr.decode())
|
129 |
|