Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.PHONY: test
test:
uv run python -m pytest -v --cov=. --cov-config=.coveragerc --cov-fail-under=80 --cov-report term-missing
uv run python -m pytest -v --cov=. --cov-config=.coveragerc --cov-fail-under=100 --cov-report term-missing

.PHONY: clean
clean:
Expand Down
18 changes: 18 additions & 0 deletions test_contributors.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,24 @@ def test_get_contributors_no_commit_end_date(self, mock_contributor_stats):
"",
)

@patch("contributors.contributor_stats.ContributorStats")
def test_get_contributors_no_end_date_skips_bot(self, mock_contributor_stats):
"""Test get_contributors skips bot users when using the repo.contributors() path."""
mock_repo = MagicMock()
mock_bot = MagicMock()
mock_bot.login = "dependabot[bot]"
mock_bot.avatar_url = "https://avatars.githubusercontent.com/u/0?v=4"
mock_bot.contributions_count = 50

mock_repo.contributors.return_value = [mock_bot]
mock_repo.full_name = "owner/repo"
ghe = ""

result = contributors_module.get_contributors(mock_repo, "2022-01-01", "", ghe)

self.assertEqual(result, [])
mock_contributor_stats.assert_not_called()

def test_get_contributors_skips_when_no_commits_in_range(self):
"""Test get_contributors returns empty list when no commits in the date range."""
mock_repo = MagicMock()
Expand Down