Skip to content

Commit d29c446

Browse files
committed
Fix existing tests
1 parent 2813425 commit d29c446

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

circfirm/cli/config.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,11 @@ def config_view(setting: str) -> None:
2828
"""View a config setting."""
2929
# Get the settings, show all settings if no specific one is specified
3030
settings = circfirm.cli.get_settings()
31+
32+
removable = "\n"
33+
3134
if not setting:
32-
click.echo(yaml.safe_dump(settings, indent=4))
35+
click.echo(yaml.safe_dump(settings, indent=4).removesuffix(removable))
3336
return
3437

3538
# Get the specified settings
@@ -44,7 +47,8 @@ def config_view(setting: str) -> None:
4447
# Show the specified setting
4548
output = yaml.safe_dump(value, indent=4)
4649
if not isinstance(value, (list, dict)):
47-
output = output.removesuffix("\n...\n")
50+
removable += "...\n"
51+
output = output.removesuffix(removable)
4852
click.echo(output)
4953

5054

circfirm/templates/settings.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
editor: ""
1+
editor: ''
22
output:
33
supporting:
44
silence: false
55
token:
6-
github: ""
6+
github: ''

tests/cli/test_cli_config.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@
1919
def get_printed_default_settings() -> None:
2020
"""Get the default (template) settings as printed."""
2121
with open("circfirm/templates/settings.yaml", encoding="utf-8") as yamlfile:
22-
settings = yaml.safe_load(yamlfile)
23-
return f"{json.dumps(settings, indent=4)}\n"
22+
return yamlfile.read()
2423

2524

2625
def test_config() -> None:

0 commit comments

Comments
 (0)