With fixtures, one can create a Spack installer test-wrapper that may be invoked multiple times to install different specs. Hence, the parent test that uses the fixture should have a way to retrieve the default value of the Spack environment used.
class MyTest(rfm.RunOnlyRegressionTest):
...
zlib_install = fixture(SpackInstallWrapper, variables={'specs:'['zlib']})
@run_before('run'):
def retrieve_spack_env(self):
env = self.zlib_install.build_system.environment