Skip to content

Commit

Permalink
tests: fix pull request dummy file (#115)
Browse files Browse the repository at this point in the history
  • Loading branch information
ReenigneArcher authored Jul 16, 2024
1 parent 9323519 commit ade2a48
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 10 deletions.
8 changes: 0 additions & 8 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,6 @@ def latest_commit(github_token):
os.environ['GITHUB_SHA'] = original_sha


@pytest.fixture(scope='function')
def dummy_github_pr_event_path():
original_value = os.getenv('GITHUB_EVENT_PATH', os.path.join(DATA_DIRECTORY, 'dummy_github_event.json'))
os.environ['GITHUB_EVENT_PATH'] = os.path.join(DATA_DIRECTORY, 'dummy_github_pr_event.json')
yield
os.environ['GITHUB_EVENT_PATH'] = original_value


@pytest.fixture(scope='function')
def dummy_github_push_event_path():
original_value = os.getenv('GITHUB_EVENT_PATH', os.path.join(DATA_DIRECTORY, 'dummy_github_event.json'))
Expand Down
4 changes: 3 additions & 1 deletion tests/data/dummy_github_pr_event.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,7 @@
"timestamp": "2024-05-13T20:55:03Z"
}
],
"pull_request": {}
"pull_request": {
"_fake_key": "this key isn't used, but needs to be here so `pull_request` doesn't evaluate to `False`"
}
}
2 changes: 1 addition & 1 deletion tests/unit/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def test_get_push_event_details(github_event_path, input_dotnet, latest_commit):
assert main.get_push_event_details()


def test_get_push_event_details_no_squash(github_event_path, mock_get_squash_and_merge_return_value):
def test_get_push_event_details_no_squash(dummy_github_push_event_path, mock_get_squash_and_merge_return_value):
with pytest.raises(SystemExit) as pytest_wrapped_e:
main.get_push_event_details()
assert pytest_wrapped_e.type == SystemExit
Expand Down

0 comments on commit ade2a48

Please sign in to comment.