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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
# Copyright 2013-2023 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
import spack.spec
from spack.main import SpackCommand
undevelop = SpackCommand("undevelop")
env = SpackCommand("env")
concretize = SpackCommand("concretize")
pytestmark = pytest.mark.not_on_windows("does not run on windows")
def test_undevelop(tmpdir, mutable_config, mock_packages, mutable_mock_env_path):
# setup environment
envdir = tmpdir.mkdir("env")
with envdir.as_cwd():
with open("spack.yaml", "w") as f:
f.write(
"""\
spack:
specs:
- mpich
develop:
mpich:
spec: mpich@1.0
path: /fake/path
"""
)
env("create", "test", "./spack.yaml")
with ev.read("test"):
before = spack.spec.Spec("mpich").concretized()
undevelop("mpich")
after = spack.spec.Spec("mpich").concretized()
# Removing dev spec from environment changes concretization
assert before.satisfies("dev_path=*")
assert not after.satisfies("dev_path=*")
def test_undevelop_nonexistent(tmpdir, mutable_config, mock_packages, mutable_mock_env_path):
# setup environment
envdir = tmpdir.mkdir("env")
with envdir.as_cwd():
with open("spack.yaml", "w") as f:
f.write(
"""\
spack:
specs:
- mpich
develop:
mpich:
spec: mpich@1.0
path: /fake/path
"""
)
env("create", "test", "./spack.yaml")
with ev.read("test") as e:
concretize()
before = e.specs_by_hash
undevelop("package-not-in-develop") # does nothing
concretize("-f")
after = e.specs_by_hash
# nothing should have changed
assert before == after
|