From f311f173fa16cb599ace45f5e0ed90c90a29b07b Mon Sep 17 00:00:00 2001 From: k-dominik Date: Mon, 8 May 2023 09:22:45 +0200 Subject: [PATCH] propagate return code in util.main_from_endpoint --- src/jgo/util.py | 2 +- tests/test_run.py | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/jgo/util.py b/src/jgo/util.py index 6b55fca..c0e0396 100644 --- a/src/jgo/util.py +++ b/src/jgo/util.py @@ -98,4 +98,4 @@ def main_from_endpoint( + paintera_argv ) - main(argv=argv) + return main(argv=argv) diff --git a/tests/test_run.py b/tests/test_run.py index f2332dd..8418833 100644 --- a/tests/test_run.py +++ b/tests/test_run.py @@ -487,5 +487,13 @@ def test_main_from_endpoint_with_jvm_args(self, run_mock): self.assertIn("org.slf4j:slf4j-simple", coordinates) +class TestUtilMainCaughtExceptions(unittest.TestCase): + def test_without_endpoint(self): + rv = main_from_endpoint( + "", argv=[], primary_endpoint_version="", secondary_endpoints=() + ) + self.assertEqual(rv, 254, "Expected return code 254.") + + if __name__ == "__main__": unittest.main()