Spaces:
Running
Running
MilesCranmer
commited on
Commit
•
8801268
1
Parent(s):
758e74a
Make sure to unset `JULIA_DEPOT_PATH` at end
Browse files- test/test_env.py +6 -0
test/test_env.py
CHANGED
@@ -15,8 +15,10 @@ class TestJuliaProject(unittest.TestCase):
|
|
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)
|
@@ -27,3 +29,7 @@ class TestJuliaProject(unittest.TestCase):
|
|
27 |
potential_shared_project_dirs = Main.eval("Pkg.envdir(DEPOT_PATH[1])")
|
28 |
self.assertEqual(cur_project_dir, potential_shared_project_dirs)
|
29 |
Main.eval("pop!(DEPOT_PATH)")
|
|
|
|
|
|
|
|
|
|
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 |
+
old_env = None
|
19 |
os.environ["JULIA_DEPOT_PATH"] = tmpdir
|
20 |
else:
|
21 |
+
old_env = os.environ["JULIA_DEPOT_PATH"]
|
22 |
os.environ["JULIA_DEPOT_PATH"] = f"{tmpdir}:{os.environ['JULIA_DEPOT_PATH']}"
|
23 |
test_env_name = "@pysr_test_env"
|
24 |
julia_helpers.install(julia_project=test_env_name)
|
|
|
29 |
potential_shared_project_dirs = Main.eval("Pkg.envdir(DEPOT_PATH[1])")
|
30 |
self.assertEqual(cur_project_dir, potential_shared_project_dirs)
|
31 |
Main.eval("pop!(DEPOT_PATH)")
|
32 |
+
if old_env is None:
|
33 |
+
del os.environ["JULIA_DEPOT_PATH"]
|
34 |
+
else:
|
35 |
+
os.environ["JULIA_DEPOT_PATH"] = old_env
|