tests: move mock config.yaml files to common directory
Test configuration files (except modules.yaml) were in the root level of test/data, but should really just be in their own directory. The absence of modules.yaml was also breaking module tests if we got module preferences after tests started, as the mock modules.yaml was not in the test directory.
This commit is contained in:
parent
3017584c48
commit
ffc91bd86e
5 changed files with 7 additions and 14 deletions
|
@ -363,23 +363,16 @@ def configuration_dir(tmpdir_factory, linux_os):
|
|||
"""
|
||||
tmpdir = tmpdir_factory.mktemp('configurations')
|
||||
|
||||
# Name of the yaml files in the test/data folder
|
||||
test_path = py.path.local(spack.paths.test_path)
|
||||
compilers_yaml = test_path.join('data', 'compilers.yaml')
|
||||
packages_yaml = test_path.join('data', 'packages.yaml')
|
||||
config_yaml = test_path.join('data', 'config.yaml')
|
||||
repos_yaml = test_path.join('data', 'repos.yaml')
|
||||
# <test_path>/data/config has mock config yaml files in it
|
||||
# copy these to the site config.
|
||||
test_config = py.path.local(spack.paths.test_path).join('data', 'config')
|
||||
test_config.copy(tmpdir.join('site'))
|
||||
|
||||
# Create temporary 'site' and 'user' folders
|
||||
tmpdir.ensure('site', dir=True)
|
||||
# Create temporary 'defaults', 'site' and 'user' folders
|
||||
tmpdir.ensure('user', dir=True)
|
||||
|
||||
# Copy the configurations that don't need further work
|
||||
packages_yaml.copy(tmpdir.join('site', 'packages.yaml'))
|
||||
config_yaml.copy(tmpdir.join('site', 'config.yaml'))
|
||||
repos_yaml.copy(tmpdir.join('site', 'repos.yaml'))
|
||||
|
||||
# Write the one that needs modifications
|
||||
# Slightly modify compilers.yaml to look like Linux
|
||||
compilers_yaml = test_config.join('compilers.yaml')
|
||||
content = ''.join(compilers_yaml.read()).format(linux_os)
|
||||
t = tmpdir.join('site', 'compilers.yaml')
|
||||
t.write(content)
|
||||
|
|
Loading…
Reference in a new issue