Пример #1
0
class InstallTest(MockPackagesTest):
    """Tests install and uninstall on a trivial package."""

    def setUp(self):
        super(InstallTest, self).setUp()

        # create a simple installable package directory and tarball
        self.repo = MockArchive()

        # We use a fake package, so skip the checksum.
        spack.do_checksum = False

        # Use a fake install directory to avoid conflicts bt/w
        # installed pkgs and mock packages.
        self.tmpdir = tempfile.mkdtemp()
        self.orig_layout = spack.install_layout
        spack.install_layout = YamlDirectoryLayout(self.tmpdir)


    def tearDown(self):
        super(InstallTest, self).tearDown()
        self.repo.destroy()

        # Turn checksumming back on
        spack.do_checksum = True

        # restore spack's layout.
        spack.install_layout = self.orig_layout
        shutil.rmtree(self.tmpdir, ignore_errors=True)


    def fake_fetchify(self, pkg):
        """Fake the URL for a package so it downloads from a file."""
        fetcher = FetchStrategyComposite()
        fetcher.append(URLFetchStrategy(self.repo.url))
        pkg.fetcher = fetcher


    def ztest_install_and_uninstall(self):
        # Get a basic concrete spec for the trivial install package.
        spec = Spec('trivial_install_test_package')
        spec.concretize()
        self.assertTrue(spec.concrete)

        # Get the package
        pkg = spack.repo.get(spec)

        self.fake_fetchify(pkg)

        try:
            pkg.do_install()
            pkg.do_uninstall()
        except Exception, e:
            pkg.remove_prefix()
            raise
Пример #2
0
    def setUp(self):
        super(InstallTest, self).setUp()

        # create a simple installable package directory and tarball
        self.repo = MockArchive()

        # We use a fake package, so skip the checksum.
        spack.do_checksum = False

        # Use a fake install directory to avoid conflicts bt/w
        # installed pkgs and mock packages.
        self.tmpdir = tempfile.mkdtemp()
        self.orig_layout = spack.install_layout
        spack.install_layout = YamlDirectoryLayout(self.tmpdir)