Skip to content

Commit

Permalink
Style fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
greenc-FNAL committed Nov 29, 2023
1 parent 89b0d3e commit 5ce4539
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
15 changes: 9 additions & 6 deletions lib/spack/spack/cmd/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,10 @@ def setup_parser(subparser):
"--file",
action="store_true",
default=False,
help="list only writable scopes with an associated file"
help="list only writable scopes with an associated file",
)
stype.add_argument(
"--non-platform",
action="store_true",
default=False,
help="list only non-platform scopes"
"--non-platform", action="store_true", default=False, help="list only non-platform scopes"
)

add_parser = sp.add_parser("add", help="add configuration parameters")
Expand Down Expand Up @@ -212,7 +209,13 @@ def config_list(args):


def config_list_scopes(args):
scopes = reversed(spack.config.CONFIG.file_scopes) if args.file else spack.config.CONFIG._non_platform_scopes if args.non_platform else reversed(spack.config.CONFIG.scopes.values())
scopes = (
reversed(spack.config.CONFIG.file_scopes)
if args.file
else spack.config.CONFIG._non_platform_scopes
if args.non_platform
else reversed(spack.config.CONFIG.scopes.values())
)
print(" ".join([s.name for s in scopes]))


Expand Down
3 changes: 3 additions & 0 deletions lib/spack/spack/test/cmd/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -661,18 +661,21 @@ def update_config(data):
with ev.Environment(str(tmpdir)) as e:
assert not e.manifest.pristine_yaml_content["spack"]["config"]["ccache"]


def test_config_list_scopes():
output = config("list-scopes")
assert "command_line" in output
assert "_builtin" in output
assert any("/" in s for s in output)


def test_config_list_scopes_file():
output = config("list-scopes", "--file")
assert "site" in output
assert "_builtin" not in output
assert any("/" in s for s in output)


def test_config_list_scopes_non_platform():
output = config("list-scopes", "--non-platform")
assert "site" in output
Expand Down

0 comments on commit 5ce4539

Please sign in to comment.