Spack tests no longer clutter var/spack/stage

- Tests use a session-scoped mock stage directory so as not to interfere
  with the real install.

- Every test is forced to clean up after itself with an additional check.
  We now automatically assert that no new files have been added to
  `spack.stage_path` during each test.

  - This means that tests that fail installs now need to clean up their
    stages, but in all other cases the check is useful.
This commit is contained in:
Todd Gamblin
2017-10-15 23:59:53 -07:00
parent 44bebd7a8f
commit d14816cbaf
6 changed files with 158 additions and 113 deletions

View File

@@ -33,11 +33,9 @@ class Canfail(Package):
version('1.0', '0123456789abcdef0123456789abcdef')
succeed = False
def install(self, spec, prefix):
try:
succeed = getattr(self, 'succeed')
if not succeed:
raise InstallError("'succeed' was false")
touch(join_path(prefix, 'an_installation_file'))
except AttributeError:
raise InstallError("'succeed' attribute was not set")
if not self.succeed:
raise InstallError("'succeed' was false")
touch(join_path(prefix, 'an_installation_file'))