From daa2cd667872cfa03809983ce5c14845f677733d Mon Sep 17 00:00:00 2001 From: Moshe Zadka Date: Fri, 5 Jan 2024 19:57:36 +0000 Subject: [PATCH] checkpoint --- pyproject.toml | 2 +- src/gather/commands.py | 11 ++++++++++- src/gather/tests/test_commands.py | 1 + 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 5cdbc4e..422f1c9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta" [project] name = "gather" -version = "2024.1.5.1" +version = "2024.1.5.2" description = "A gatherer" readme = "README.rst" authors = [{name = "Moshe Zadka", email = "moshez@zadka.club"}] diff --git a/src/gather/commands.py b/src/gather/commands.py index d65a095..e8c9f2e 100644 --- a/src/gather/commands.py +++ b/src/gather/commands.py @@ -116,7 +116,15 @@ def wrapped_dry_run(cmdargs, **kwargs): args.orig_run = orig_run -def run_maybe_dry(*, parser, argv=sys.argv, env=os.environ, sp_run=subprocess.run, is_subcommand=False, prefix=None): +def run_maybe_dry( + *, + parser, + argv=sys.argv, + env=os.environ, + sp_run=subprocess.run, + is_subcommand=False, + prefix=None, +): """ Run commands that only take ``args``. @@ -128,6 +136,7 @@ def run_maybe_dry(*, parser, argv=sys.argv, env=os.environ, sp_run=subprocess.ru * ``safe_run``: Run with logging * ``orig_run``: Original function """ + def error(args): parser.print_help() raise SystemExit(1) diff --git a/src/gather/tests/test_commands.py b/src/gather/tests/test_commands.py index 52d44db..a29023a 100644 --- a/src/gather/tests/test_commands.py +++ b/src/gather/tests/test_commands.py @@ -138,6 +138,7 @@ def test_custom_parser(self): contains_string("custom help message"), ) + class CommandMaybeDryTest(unittest.TestCase): """Test run_maybe_dry"""