summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorPeter Scheibel <scheibel1@llnl.gov>2016-03-23 19:49:28 -0700
committerPeter Scheibel <scheibel1@llnl.gov>2016-03-23 19:49:28 -0700
commited0f6f75a7215c959431377ffe7e4faf09dc88d6 (patch)
treeba5fbc140df839768e1c3b1c99b7903940f07322 /lib
parentcb9fba98d8d0c389f3295d5d30cdb650e6ea79b7 (diff)
downloadspack-ed0f6f75a7215c959431377ffe7e4faf09dc88d6.tar.gz
spack-ed0f6f75a7215c959431377ffe7e4faf09dc88d6.tar.bz2
spack-ed0f6f75a7215c959431377ffe7e4faf09dc88d6.tar.xz
spack-ed0f6f75a7215c959431377ffe7e4faf09dc88d6.zip
clear test cache before and after each MockPackagesTest (I think Ive got a better way to avoid test fragility but Ill add this for now)
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/cmd/test.py2
-rw-r--r--lib/spack/spack/test/git_fetch.py5
-rw-r--r--lib/spack/spack/test/mock_packages_test.py7
3 files changed, 8 insertions, 6 deletions
diff --git a/lib/spack/spack/cmd/test.py b/lib/spack/spack/cmd/test.py
index 9a85c7d270..233cd186f0 100644
--- a/lib/spack/spack/cmd/test.py
+++ b/lib/spack/spack/cmd/test.py
@@ -70,4 +70,4 @@ def test(parser, args):
spack.cache_path = join_path(spack.var_path, "test-cache")
mkdirp(spack.cache_path)
spack.test.run(args.names, outputDir, args.verbose)
- shutil.rmtree(spack.cache_path)
+ shutil.rmtree(spack.cache_path, ignore_errors=True)
diff --git a/lib/spack/spack/test/git_fetch.py b/lib/spack/spack/test/git_fetch.py
index 76814f089a..d3e1206c13 100644
--- a/lib/spack/spack/test/git_fetch.py
+++ b/lib/spack/spack/test/git_fetch.py
@@ -30,9 +30,6 @@ from spack.test.mock_packages_test import *
from spack.test.mock_repo import MockGitRepo
from spack.version import ver
-import shutil
-import os
-
class GitFetchTest(MockPackagesTest):
"""Tests fetching from a dummy git repository."""
@@ -51,8 +48,6 @@ class GitFetchTest(MockPackagesTest):
"""Destroy the stage space used by this test."""
super(GitFetchTest, self).tearDown()
self.repo.destroy()
- for d in os.listdir(spack.cache_path):
- shutil.rmtree(os.path.join(spack.cache_path, d))
def assert_rev(self, rev):
"""Check that the current git revision is equal to the supplied rev."""
diff --git a/lib/spack/spack/test/mock_packages_test.py b/lib/spack/spack/test/mock_packages_test.py
index 6d24a84150..85c15d4a6a 100644
--- a/lib/spack/spack/test/mock_packages_test.py
+++ b/lib/spack/spack/test/mock_packages_test.py
@@ -125,9 +125,16 @@ class MockPackagesTest(unittest.TestCase):
pkg.dependencies.update(deps)
+ def rm_cache(self):
+ shutil.rmtree(spack.cache_path, ignore_errors=True)
+
+
def setUp(self):
+ self.rm_cache()
+ mkdirp(spack.cache_path)
self.initmock()
def tearDown(self):
+ self.rm_cache()
self.cleanmock()