Skip to content

Commit

Permalink
Keep test path config when restoring environment in tests
Browse files Browse the repository at this point in the history
This fixes `test_toy_multi_deps` which restores the environment in the
middle of the test and then misses the --sourcepath modification done at test setup.
  • Loading branch information
Flamefire committed Sep 12, 2024
1 parent 6d8e185 commit 16c5e41
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions test/framework/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,6 @@ def setUp(self):
os.close(fd)
self.cwd = os.getcwd()

# keep track of original environment to restore
self.orig_environ = copy.deepcopy(os.environ)

# keep track of original environment/Python search path to restore
self.orig_sys_path = sys.path[:]

Expand All @@ -125,6 +122,10 @@ def setUp(self):
# make sure that the tests only pick up easyconfigs provided with the tests
os.environ['EASYBUILD_ROBOT_PATHS'] = os.path.join(testdir, 'easyconfigs', 'test_ecs')

# keep track of original environment to restore
# Do this AFTER setting the above paths to keep those when restoring
self.orig_environ = copy.deepcopy(os.environ)

# make sure that the EasyBuild installation is still known even if we purge an EB module
if os.getenv('EB_SCRIPT_PATH') is None:
eb_path = which('eb')
Expand Down

0 comments on commit 16c5e41

Please sign in to comment.