Skip to content

Commit

Permalink
adapt test_loaders for exit() call
Browse files Browse the repository at this point in the history
  • Loading branch information
shoshta73 committed Nov 17, 2024
1 parent 1684972 commit 1892271
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tests/test_loaders.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
@pytest.mark.parametrize("file_name", ["jsonc.json", "json.json"])
def test_load_jsonc(file_name):
# we are mocking sys.exit to check if it has been called
with mock.patch("sys.exit") as mock_exit:
with mock.patch("builtins.exit") as mock_exit:
result = load_jsonc(f"data/{file_name}")
if file_name == "jsonc.json":
assert result == {"key1": "value1", "key2": 42, "key3": True}
Expand All @@ -23,7 +23,7 @@ def test_load_jsonc(file_name):
@pytest.mark.parametrize("file_name", ["jsonc.json", "json.json"])
def test_load_json(file_name):
# we are mocking sys.exit to check if it has been called
with mock.patch("sys.exit") as mock_exit:
with mock.patch("builtins.exit") as mock_exit:
result = load_json(f"data/{file_name}")
if file_name == "jsonc.json":
mock_exit.assert_called_once_with(1)
Expand Down

0 comments on commit 1892271

Please sign in to comment.