diff --git a/reframe/core/environments.py b/reframe/core/environments.py index bf0fae2add..83aca292ab 100644 --- a/reframe/core/environments.py +++ b/reframe/core/environments.py @@ -16,7 +16,7 @@ class Environment: to be set when this environment is loaded by the framework. Users may not create or modify directly environments. """ - name = fields.StringPatternField('name', '(\w|-)+') + name = fields.StringPatternField('name', r'(\w|-)+') modules = fields.TypedListField('modules', str) variables = fields.TypedDictField('variables', str, str) @@ -80,12 +80,13 @@ def load(self): if rt.modules_system.is_module_loaded(m): self._preloaded.add(m) - self._conflicted += rt.modules_system.load_module(m, force=True) - for conflict in self._conflicted: - stmts = rt.modules_system.emit_unload_commands(conflict) + conflicted = rt.modules_system.load_module(m, force=True) + for c in conflicted: + stmts = rt.modules_system.emit_unload_commands(c) self._load_stmts += stmts self._load_stmts += rt.modules_system.emit_load_commands(m) + self._conflicted += conflicted for k, v in self._variables.items(): if k in os.environ: