1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import pytest
import spack.environment as ev
from spack.main import SpackCommand, SpackCommandError
# everything here uses the mock_env_path
pytestmark = pytest.mark.usefixtures(
"mutable_mock_env_path", "config", "mutable_mock_repo"
)
@pytest.mark.disable_clean_stage_check
def test_fetch_in_env(
tmpdir, mock_archive, mock_stage, mock_fetch, install_mockery
):
SpackCommand("env")("create", "test")
with ev.read("test"):
SpackCommand("add")("python")
with pytest.raises(SpackCommandError):
SpackCommand("fetch")()
SpackCommand("concretize")()
SpackCommand("fetch")()
@pytest.mark.disable_clean_stage_check
def test_fetch_single_spec(
tmpdir, mock_archive, mock_stage, mock_fetch, install_mockery
):
SpackCommand("fetch")("mpileaks")
@pytest.mark.disable_clean_stage_check
def test_fetch_multiple_specs(
tmpdir, mock_archive, mock_stage, mock_fetch, install_mockery
):
SpackCommand("fetch")("mpileaks", "gcc@10.2.0", "python")
def test_fetch_no_argument():
with pytest.raises(SpackCommandError):
SpackCommand("fetch")()
|