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')
|
tmpdir = tmpdir_factory.mktemp('configurations')
|
||||||
|
|
||||||
# Name of the yaml files in the test/data folder
|
# <test_path>/data/config has mock config yaml files in it
|
||||||
test_path = py.path.local(spack.paths.test_path)
|
# copy these to the site config.
|
||||||
compilers_yaml = test_path.join('data', 'compilers.yaml')
|
test_config = py.path.local(spack.paths.test_path).join('data', 'config')
|
||||||
packages_yaml = test_path.join('data', 'packages.yaml')
|
test_config.copy(tmpdir.join('site'))
|
||||||
config_yaml = test_path.join('data', 'config.yaml')
|
|
||||||
repos_yaml = test_path.join('data', 'repos.yaml')
|
|
||||||
|
|
||||||
# Create temporary 'site' and 'user' folders
|
# Create temporary 'defaults', 'site' and 'user' folders
|
||||||
tmpdir.ensure('site', dir=True)
|
|
||||||
tmpdir.ensure('user', dir=True)
|
tmpdir.ensure('user', dir=True)
|
||||||
|
|
||||||
# Copy the configurations that don't need further work
|
# Slightly modify compilers.yaml to look like Linux
|
||||||
packages_yaml.copy(tmpdir.join('site', 'packages.yaml'))
|
compilers_yaml = test_config.join('compilers.yaml')
|
||||||
config_yaml.copy(tmpdir.join('site', 'config.yaml'))
|
|
||||||
repos_yaml.copy(tmpdir.join('site', 'repos.yaml'))
|
|
||||||
|
|
||||||
# Write the one that needs modifications
|
|
||||||
content = ''.join(compilers_yaml.read()).format(linux_os)
|
content = ''.join(compilers_yaml.read()).format(linux_os)
|
||||||
t = tmpdir.join('site', 'compilers.yaml')
|
t = tmpdir.join('site', 'compilers.yaml')
|
||||||
t.write(content)
|
t.write(content)
|
||||||
|
|
Loading…
Reference in a new issue