Skip to content

Commit

Permalink
Update lib/spack/spack/test/modules/tcl.py to match syntax change in …
Browse files Browse the repository at this point in the history
…tcl modulefile template
  • Loading branch information
climbfuji committed Sep 6, 2023
1 parent c580745 commit e7d46da
Showing 1 changed file with 40 additions and 5 deletions.
45 changes: 40 additions & 5 deletions lib/spack/spack/test/modules/tcl.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,14 @@ def test_autoload_direct(self, modulefile_content, module_configuration):
content = modulefile_content(mpileaks_spec_string)

assert (
len([x for x in content if "if {![info exists ::env(LMOD_VERSION_MAJOR)]} {" in x])
len(
[
x
for x in content
if "if {![info exists ::env(LMOD_VERSION_MAJOR)] && ![info exists ::env(LMOD_VERSION)]} {" # noqa: E501
in x
]
)
== 1
)
assert len([x for x in content if "depends-on " in x]) == 2
Expand All @@ -52,7 +59,14 @@ def test_autoload_direct(self, modulefile_content, module_configuration):
content = modulefile_content("dtbuild1")

assert (
len([x for x in content if "if {![info exists ::env(LMOD_VERSION_MAJOR)]} {" in x])
len(
[
x
for x in content
if "if {![info exists ::env(LMOD_VERSION_MAJOR)] && ![info exists ::env(LMOD_VERSION)]} {" # noqa: E501
in x
]
)
== 1
)
assert len([x for x in content if "depends-on " in x]) == 2
Expand All @@ -69,7 +83,14 @@ def test_autoload_all(self, modulefile_content, module_configuration):
content = modulefile_content(mpileaks_spec_string)

assert (
len([x for x in content if "if {![info exists ::env(LMOD_VERSION_MAJOR)]} {" in x])
len(
[
x
for x in content
if "if {![info exists ::env(LMOD_VERSION_MAJOR)] && ![info exists ::env(LMOD_VERSION)]} {" # noqa: E501
in x
]
)
== 1
)
assert len([x for x in content if "depends-on " in x]) == 5
Expand All @@ -83,7 +104,14 @@ def test_autoload_all(self, modulefile_content, module_configuration):
content = modulefile_content("dtbuild1")

assert (
len([x for x in content if "if {![info exists ::env(LMOD_VERSION_MAJOR)]} {" in x])
len(
[
x
for x in content
if "if {![info exists ::env(LMOD_VERSION_MAJOR)] && ![info exists ::env(LMOD_VERSION)]} {" # noqa: E501
in x
]
)
== 1
)
assert len([x for x in content if "depends-on " in x]) == 2
Expand Down Expand Up @@ -476,7 +504,14 @@ def test_autoload_with_constraints(self, modulefile_content, module_configuratio
# Test the mpileaks that should NOT have the autoloaded dependencies
content = modulefile_content("mpileaks ^mpich")
assert (
len([x for x in content if "if {![info exists ::env(LMOD_VERSION_MAJOR)]} {" in x])
len(
[
x
for x in content
if "if {![info exists ::env(LMOD_VERSION_MAJOR)] && ![info exists ::env(LMOD_VERSION)]} {" # noqa: E501
in x
]
)
== 0
)
assert len([x for x in content if "depends-on " in x]) == 0
Expand Down

0 comments on commit e7d46da

Please sign in to comment.