diff --git a/tests/test_reports_accrual.py b/tests/test_reports_accrual.py index c477e06a2c19e357c7e512dfe973fb1ffc9a2c56..1df5f9036b4faada5089ffaecf86c85f62fd9518 100644 --- a/tests/test_reports_accrual.py +++ b/tests/test_reports_accrual.py @@ -684,10 +684,11 @@ def run_main(arglist, config=None, out_type=io.StringIO): errors.seek(0) return retcode, output, errors -def check_main_fails(arglist, config, error_flags): +def check_main_fails(arglist, config, expect_retcode): + if not isinstance(expect_retcode, int): + expect_retcode = cliutil.ExitCode[expect_retcode] retcode, output, errors = run_main(arglist, config) - assert retcode > 16 - assert (retcode - 16) & error_flags + assert retcode == expect_retcode assert not output.getvalue() return errors @@ -775,7 +776,7 @@ def test_main_aging_report(arglist): check_aging_ods(output, datetime.date.today(), recv_rows, pay_rows) def test_main_no_books(): - errors = check_main_fails([], testutil.TestConfig(), 1 | 2) + errors = check_main_fails([], testutil.TestConfig(), 'NoConfiguration') testutil.check_lines_match(iter(errors), [ r':[01]: +no books to load in configuration\b', ]) @@ -786,7 +787,7 @@ def test_main_no_books(): ['-t', 'balance', 'entity=NonExistent'], ]) def test_main_no_matches(arglist, caplog): - check_main_fails(arglist, None, 2) + check_main_fails(arglist, None, 'NoDataFiltered') testutil.check_logs_match(caplog, [ ('WARNING', 'no matching entries found to report'), ]) @@ -795,7 +796,7 @@ def test_main_no_rt(caplog): config = testutil.TestConfig( books_path=testutil.test_path('books/accruals.beancount'), ) - check_main_fails(['-t', 'out'], config, 16) + check_main_fails(['-t', 'out'], config, 'NoConfiguration') testutil.check_logs_match(caplog, [ ('ERROR', 'unable to generate outgoing report: RT client is required'), ])