Spaces:
Running
Running
MilesCranmer
commited on
Commit
•
758e74a
1
Parent(s):
f68c622
Set `JULIA_DEPOT_PATH` in env test
Browse files- test/test_env.py +9 -5
test/test_env.py
CHANGED
@@ -1,19 +1,23 @@
|
|
1 |
-
"""Contains tests for creating and initializing custom Julia projects"""
|
2 |
|
3 |
import unittest
|
|
|
4 |
from pysr import julia_helpers
|
5 |
from tempfile import TemporaryDirectory
|
6 |
|
7 |
|
8 |
class TestJuliaProject(unittest.TestCase):
|
|
|
|
|
9 |
def test_custom_shared_env(self):
|
10 |
-
"""Test that we can use PySR in a custom shared env"""
|
11 |
with TemporaryDirectory() as tmpdir:
|
12 |
# Create a temp depot to store julia packages (and our custom env)
|
13 |
Main = julia_helpers.init_julia()
|
14 |
-
|
15 |
-
|
16 |
-
|
|
|
17 |
test_env_name = "@pysr_test_env"
|
18 |
julia_helpers.install(julia_project=test_env_name)
|
19 |
Main = julia_helpers.init_julia(julia_project=test_env_name)
|
|
|
1 |
+
"""Contains tests for creating and initializing custom Julia projects."""
|
2 |
|
3 |
import unittest
|
4 |
+
import os
|
5 |
from pysr import julia_helpers
|
6 |
from tempfile import TemporaryDirectory
|
7 |
|
8 |
|
9 |
class TestJuliaProject(unittest.TestCase):
|
10 |
+
"""Various tests for working with Julia projects."""
|
11 |
+
|
12 |
def test_custom_shared_env(self):
|
13 |
+
"""Test that we can use PySR in a custom shared env."""
|
14 |
with TemporaryDirectory() as tmpdir:
|
15 |
# Create a temp depot to store julia packages (and our custom env)
|
16 |
Main = julia_helpers.init_julia()
|
17 |
+
if "JULIA_DEPOT_PATH" not in os.environ:
|
18 |
+
os.environ["JULIA_DEPOT_PATH"] = tmpdir
|
19 |
+
else:
|
20 |
+
os.environ["JULIA_DEPOT_PATH"] = f"{tmpdir}:{os.environ['JULIA_DEPOT_PATH']}"
|
21 |
test_env_name = "@pysr_test_env"
|
22 |
julia_helpers.install(julia_project=test_env_name)
|
23 |
Main = julia_helpers.init_julia(julia_project=test_env_name)
|