Skip to content

Commit 65b61be

Browse files
committed
Keep test path config when restoring environment in tests
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.
1 parent 9b4b7b3 commit 65b61be

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

test/framework/utilities.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
from easybuild.framework.easyblock import EasyBlock
5050
from easybuild.main import main
5151
from easybuild.tools import config
52-
from easybuild.tools.config import GENERAL_CLASS, Singleton, module_classes, update_build_option
52+
from easybuild.tools.config import GENERAL_CLASS, Singleton, module_classes
5353
from easybuild.tools.configobj import ConfigObj
5454
from easybuild.tools.environment import modify_env
5555
from easybuild.tools.filetools import copy_dir, mkdir, read_file, which
@@ -106,8 +106,8 @@ def setUp(self):
106106
os.close(fd)
107107
self.cwd = os.getcwd()
108108

109-
# keep track of original environment to restore
110-
self.orig_environ = copy.deepcopy(os.environ)
109+
# keep track of original environment to restore after tests
110+
self._initial_environ = copy.deepcopy(os.environ)
111111

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

134+
# disable progress bars when running the tests,
135+
# since it messes with test suite progress output when test installations are performed
136+
os.environ['EASYBUILD_DISABLE_SHOW_PROGRESS_BAR'] = '1'
137+
138+
# Store the environment as setup (including the above paths) for tests to restore
139+
self.orig_environ = copy.deepcopy(os.environ)
140+
134141
# make sure no deprecated behaviour is being triggered (unless intended by the test)
135142
self.orig_current_version = eb_build_log.CURRENT_VERSION
136143
self.disallow_deprecated_behaviour()
137144

138145
init_config()
139146

140-
# disable progress bars when running the tests,
141-
# since it messes with test suite progress output when test installations are performed
142-
os.environ['EASYBUILD_DISABLE_SHOW_PROGRESS_BAR'] = '1'
143-
update_build_option('show_progress_bar', False)
144-
145147
import easybuild
146148
# try to import easybuild.easyblocks(.generic) packages
147149
# it's OK if it fails here, but important to import first before fiddling with sys.path

0 commit comments

Comments
 (0)