Skip to content

Commit

Permalink
Fix tests #2
Browse files Browse the repository at this point in the history
  • Loading branch information
flipbit03 committed Nov 16, 2024
1 parent 767cbe2 commit 1b02db8
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion tests/test_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,16 @@ def test_assert_function_actually_gets_called(mock_exit):
# The "noqa" flag here is important, or else our pre-commit hooks (flake) will remove this assignment.
__name__ = "__main__" # noqa

@main
def my_main_func():
"""
The answer to life, the universe, and everything.
"""
builtins.exit(42)

my_main_func.__module__ = "__main__"

# Decorate it
main(my_main_func)

# Ensure that our main function was able to call mock_exit with the expected value.
assert EXIT_CODE_RECEIVED == 42

0 comments on commit 1b02db8

Please sign in to comment.