Skip to content

Commit d3606f5

Browse files
committed
update test to ensure contributor info is accurately portrayed
1 parent b8a7bd5 commit d3606f5

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

tests/integration/test_update_cp_org_libraries.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,23 @@ def mock_list_repos(*args, **kwargs):
3636
]
3737

3838

39+
# pylint: disable=unused-argument
40+
def mock_get_contribs(*args):
41+
"""Function to monkeypatch `update_cp_org_libraries.get_contributors()` to ensure
42+
proper testing of usage. Monkeypatched `list_repos` will likely not produce results.
43+
"""
44+
contribs = ["test_user1", "test_user2"]
45+
reviewers = ["test_reviewer1", "test_reviewer2"]
46+
merged_pr_count = 4
47+
48+
return contribs, reviewers, merged_pr_count
49+
50+
3951
def test_update_cp_org_libraries(monkeypatch):
4052
"""Test main function of 'circuitpyton_libraries.py', without writing an output file."""
4153

4254
monkeypatch.setattr(common_funcs, "list_repos", mock_list_repos)
55+
monkeypatch.setattr(update_cp_org_libraries, "get_contributors", mock_get_contribs)
4356

4457
update_cp_org_libraries.main()
4558

@@ -49,6 +62,7 @@ def test_update_cp_org_libraries_output_file(monkeypatch, tmp_path, capsys):
4962
"""Test main funciton of 'update_cp_org_libraries.py', with writing an output file."""
5063

5164
monkeypatch.setattr(common_funcs, "list_repos", mock_list_repos)
65+
monkeypatch.setattr(update_cp_org_libraries, "get_contributors", mock_get_contribs)
5266

5367
tmp_output_file = tmp_path / "output_test.txt"
5468

0 commit comments

Comments
 (0)