Skip to content

Commit

Permalink
Display non-default debris values in help screen
Browse files Browse the repository at this point in the history
  • Loading branch information
bittner committed Sep 20, 2023
1 parent 5b25a89 commit 8b8cbdb
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pyclean/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,11 @@ def parse_arguments():
nargs='*', default=argparse.SUPPRESS, choices=debris_choices,
help='remove leftovers from popular Python development '
'tools (may be specified multiple times; '
'default: %s)' % ' '.join(debris_default_topics))
'optional: all %s; default: %s)' % (
' '.join(debris_optional_topics),
' '.join(debris_default_topics),
),
)
parser.add_argument('-e', '--erase', metavar='PATTERN', action='extend',
nargs='+', default=[],
help='delete files or folders matching a globbing '
Expand Down
17 changes: 17 additions & 0 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"""
import os
import platform
import re
import sys
from importlib import import_module

Expand Down Expand Up @@ -179,6 +180,22 @@ def test_debris_default_args():
assert args.debris == ['cache', 'coverage', 'package', 'pytest']


def test_debris_optional_args():
"""
Does the help screen explain all --debris options?
"""
expected_debris_options_help = (
'(may be specified multiple times; '
'optional: all jupyter mypy ruff tox; '
'default: cache coverage package pytest)'
)

result = shell('pyclean --help')
normalized_stdout = re.sub(r'\n *', ' ', result.stdout)

assert expected_debris_options_help in normalized_stdout


def test_debris_all():
"""
Does calling `pyclean --debris all` pick all topics?
Expand Down

0 comments on commit 8b8cbdb

Please sign in to comment.