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 9847816
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions test/framework/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ 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 to restore after tests
self._initial_environ = copy.deepcopy(os.environ)

# keep track of original environment/Python search path to restore
self.orig_sys_path = sys.path[:]
Expand All @@ -131,17 +131,19 @@ def setUp(self):
if eb_path is not None:
os.environ['EB_SCRIPT_PATH'] = eb_path

# disable progress bars when running the tests,
# since it messes with test suite progress output when test installations are performed
os.environ['EASYBUILD_DISABLE_SHOW_PROGRESS_BAR'] = '1'

# Store the environment as setup (including the above paths) for tests to restore
self.orig_environ = copy.deepcopy(os.environ)

# make sure no deprecated behaviour is being triggered (unless intended by the test)
self.orig_current_version = eb_build_log.CURRENT_VERSION
self.disallow_deprecated_behaviour()

init_config()

# disable progress bars when running the tests,
# since it messes with test suite progress output when test installations are performed
os.environ['EASYBUILD_DISABLE_SHOW_PROGRESS_BAR'] = '1'
update_build_option('show_progress_bar', False)

import easybuild
# try to import easybuild.easyblocks(.generic) packages
# it's OK if it fails here, but important to import first before fiddling with sys.path
Expand Down

0 comments on commit 9847816

Please sign in to comment.