copy test data into './data' in test environment

This commit is contained in:
Gregory Becker
2020-01-17 17:33:05 -08:00
committed by Tamara Dahlgren
parent 8a34511789
commit 966fc427a9

View File

@@ -55,6 +55,8 @@
from spack.filesystem_view import YamlFilesystemView
from spack.installer import \
install_args_docstring, PackageInstaller, InstallError
from spack.util.executable import which
from spack.util.prefix import Prefix
from spack.stage import stage_prefix, Stage, ResourceStage, StageComposite
from spack.util.package_hash import package_hash
from spack.version import Version
@@ -1610,11 +1612,18 @@ def test_process():
tty.set_debug(True)
# setup test directory
alltestsdir = os.path.join(os.getcwd(), 'spack-tests')
testdir = os.path.join(alltestsdir,
self.spec.format('{name}-{hash}'))
alltestsdir = Prefix(os.getcwd()).join('spack-tests')
testdir = alltestsdir.join(self.spec.format('{name}-{hash}'))
if os.path.exists(testdir):
shutil.rmtree(testdir)
mkdirp(testdir)
# copy test data into testdir/data
datadir = Prefix(self.package_dir).test
if os.path.isdir(datadir):
shutil.copytree(datadir, testdir.data)
try:
mkdirp(testdir)
os.chdir(testdir)
self.test()
except Exception as e: