def test_bad_git(tmpdir, mock_bad_git): """Trigger a SpackError when attempt a fetch with a bad git.""" testpath = str(tmpdir) with pytest.raises(spack.error.SpackError): fetcher = GitFetchStrategy(git='file:///not-a-real-git-repo') with Stage(fetcher, path=testpath): fetcher.fetch()
def test_git_extra_fetch(tmpdir): """Ensure a fetch after 'expanding' is effectively a no-op.""" testpath = str(tmpdir) fetcher = GitFetchStrategy(git='file:///not-a-real-git-repo') with Stage(fetcher, path=testpath) as stage: mkdirp(stage.source_path) fetcher.fetch() # Use fetcher to fetch for code coverage shutil.rmtree(stage.source_path)
def test_needs_stage(): """Trigger a NoStageError when attempt a fetch without a stage.""" with pytest.raises(spack.fetch_strategy.NoStageError, match=r"set_stage.*before calling fetch"): fetcher = GitFetchStrategy(git='file:///not-a-real-git-repo') fetcher.fetch()
def test_needs_stage(): """Trigger a NoStageError when attempt a fetch without a stage.""" with pytest.raises(spack.fetch_strategy.NoStageError, matches=_mock_transport_error): fetcher = GitFetchStrategy(git='file:///not-a-real-git-repo') fetcher.fetch()