-
Notifications
You must be signed in to change notification settings - Fork 117
Closed
Description
In order to reproduce, you need a modules system and the following test file:
import reframe as rfm
import reframe.utility.sanity as sn
@rfm.simple_test
class Test0(rfm.RunOnlyRegressionTest):
def __init__(self):
self.valid_systems = ['*']
self.valid_prog_environs = ['*']
self.executable = 'echo $TESTMOD_FOO'
self.modules = ['testmod_foo', 'xxx']
self.sanity_patterns = sn.assert_found('FOO', self.stdout)
@rfm.simple_test
class Test1(rfm.RunOnlyRegressionTest):
def __init__(self):
self.valid_systems = ['*']
self.valid_prog_environs = ['*']
self.executable = 'echo $TESTMOD_FOO'
self.sanity_patterns = sn.assert_not_found('FOO', self.stdout)How to reproduce it:
module use $(pwd)/unittests/modules
./bin/reframe -C myconfig_with_modules_system.py -c path/to/the/test/above.py -r
Then you will notice that the second test will fail, meaning that it finds the variable that was set inside the testmod_foo module.
[ FAILED ] Ran 2 test case(s) from 2 check(s) (2 failure(s))
If you run Test1 individually, it passes as expected:
[ OK ] (1/1) Test1 on tresa:default using builtin [compile: 0.012s run: 0.403s total: 0.445s]
This bug comes from here https://github.com/eth-cscs/reframe/blob/master/reframe/core/runtime.py#L224. This should be in a try/finally block and the environment must always be restored. This is called during the run phase of the test.