Skip to content

Commit

Permalink
fix(warn): Address warnings during tests
Browse files Browse the repository at this point in the history
Needs a `fix(.+): .+` commit message to trigger a release after the last failure.
  • Loading branch information
rpatterson committed Oct 29, 2023
1 parent 6d79e2d commit 6c96227
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
1 change: 1 addition & 0 deletions newsfragments/+release.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Trigger a release after the v2.0.0b0 release failure.
4 changes: 4 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,10 @@ devel =
testpaths = src/prunerr
filterwarnings =
error
# BBB: Remove once Python <=3.11 support has been removed:
ignore:onerror argument is deprecated:DeprecationWarning:prunerr.downloadclient
# BBB: Remove once arrapi fixes this issue:
ignore:pkg_resources is deprecated as an API:DeprecationWarning:arrapi

[coverage:run]
command_line = -m pytest --junit-xml=pytest-junit.xml
Expand Down
14 changes: 9 additions & 5 deletions src/prunerr/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,17 +250,21 @@ def _main(args=None):
Inner main command-line handler for outer exception handling.
"""
# Parse command-line options and positional arguments:
parsed_args = parser.parse_args(args=args)
parsed_args = argparse.Namespace()
try:
parsed_args = parser.parse_args(args=args, namespace=parsed_args)
finally:
# Use `argparse` to validate that the config file exists and can be read, then
# pass the path into the runner:
if callable(getattr(parsed_args.config, "close", None)): # pragma: no cover
with contextlib.closing(parsed_args.config):
parsed_args.config = parsed_args.config.name
# Avoid noisy boilerplate, functions meant to handle command-line usage should
# accept kwargs that match the defined option and argument names:
cli_kwargs = dict(vars(parsed_args))
# Remove any meta options and arguments, those used to direct option and argument
# handling:
del cli_kwargs["command"]
# Use `argparse` to validate that the config file exists and can be read, then pass
# the path into the runner.
with contextlib.closing(cli_kwargs["config"]):
cli_kwargs["config"] = cli_kwargs["config"].name
# Separate the arguments for the subcommand:
prunerr_dests = {
action.dest for action in parser._actions # pylint: disable=protected-access
Expand Down

0 comments on commit 6c96227

Please sign in to comment.