66
77import contributors as contributors_module
88from contributor_stats import ContributorStats
9- from contributors import get_all_contributors , get_contributors
109
1110
1211class TestContributors (unittest .TestCase ):
@@ -27,7 +26,7 @@ def test_get_contributors(self, mock_contributor_stats):
2726 mock_repo .contributors .return_value = [mock_user ]
2827 mock_repo .full_name = "owner/repo"
2928
30- get_contributors (mock_repo , "2022-01-01" , "2022-12-31" , "" )
29+ contributors_module . get_contributors (mock_repo , "2022-01-01" , "2022-12-31" , "" )
3130
3231 mock_contributor_stats .assert_called_once_with (
3332 "user" ,
@@ -60,7 +59,7 @@ def test_get_all_contributors_with_organization(self, mock_get_contributors):
6059 ]
6160 ghe = ""
6261
63- result = get_all_contributors (
62+ result = contributors_module . get_all_contributors (
6463 "org" , "" , "2022-01-01" , "2022-12-31" , mock_github_connection , ghe
6564 )
6665
@@ -99,7 +98,7 @@ def test_get_all_contributors_with_repository(self, mock_get_contributors):
9998 ]
10099 ghe = ""
101100
102- result = get_all_contributors (
101+ result = contributors_module . get_all_contributors (
103102 "" , ["owner/repo" ], "2022-01-01" , "2022-12-31" , mock_github_connection , ghe
104103 )
105104
@@ -140,7 +139,7 @@ def test_get_contributors_skip_users_with_no_commits(self, mock_contributor_stat
140139 mock_repo .get_commits .side_effect = StopIteration
141140 ghe = ""
142141
143- get_contributors (mock_repo , "2022-01-01" , "2022-12-31" , ghe )
142+ contributors_module . get_contributors (mock_repo , "2022-01-01" , "2022-12-31" , ghe )
144143
145144 # Note that only user is returned and user2 is not returned here because there were no commits in the date range
146145 mock_contributor_stats .assert_called_once_with (
@@ -168,7 +167,7 @@ def test_get_contributors_skip_bot(self, mock_contributor_stats):
168167 mock_repo .get_commits .side_effect = StopIteration
169168 ghe = ""
170169
171- get_contributors (mock_repo , "2022-01-01" , "2022-12-31" , ghe )
170+ contributors_module . get_contributors (mock_repo , "2022-01-01" , "2022-12-31" , ghe )
172171
173172 # Note that only user is returned and user2 is not returned here because there were no commits in the date range
174173 mock_contributor_stats .isEmpty ()
@@ -189,7 +188,7 @@ def test_get_contributors_no_commit_end_date(self, mock_contributor_stats):
189188 mock_repo .get_commits .side_effect = StopIteration
190189 ghe = ""
191190
192- get_contributors (mock_repo , "2022-01-01" , "" , ghe )
191+ contributors_module . get_contributors (mock_repo , "2022-01-01" , "" , ghe )
193192
194193 # Note that only user is returned and user2 is not returned here because there were no commits in the date range
195194 mock_contributor_stats .assert_called_once_with (
@@ -212,7 +211,9 @@ def test_get_contributors_skips_when_no_commits_in_range(self):
212211 mock_repo .full_name = "owner/repo"
213212 mock_repo .commits .return_value = iter ([])
214213
215- result = get_contributors (mock_repo , "2022-01-01" , "2022-12-31" , "" )
214+ result = contributors_module .get_contributors (
215+ mock_repo , "2022-01-01" , "2022-12-31" , ""
216+ )
216217
217218 self .assertEqual (result , [])
218219
@@ -230,7 +231,9 @@ def __iter__(self):
230231 mock_repo .contributors .return_value = BoomIterable ()
231232
232233 with patch ("builtins.print" ) as mock_print :
233- result = get_contributors (mock_repo , "2022-01-01" , "2022-12-31" , "" )
234+ result = contributors_module .get_contributors (
235+ mock_repo , "2022-01-01" , "2022-12-31" , ""
236+ )
234237
235238 self .assertIsNone (result )
236239 mock_print .assert_any_call (
@@ -251,7 +254,7 @@ def test_main_runs_under_main_guard(self):
251254 "" ,
252255 "2022-01-01" ,
253256 "2022-12-31" ,
254- "true" ,
257+ True ,
255258 False ,
256259 )
257260
0 commit comments