diff --git a/Makefile b/Makefile index 9244677..23e9bde 100644 --- a/Makefile +++ b/Makefile @@ -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: diff --git a/test_contributors.py b/test_contributors.py index 1a2883a..cbcd37d 100644 --- a/test_contributors.py +++ b/test_contributors.py @@ -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()