Skip to content

Commit 8715c3c

Browse files
authored
Merge pull request #240 from sommersoft/report_order
Update CircuitPython Report Order & Emergency Fix
2 parents 3dfaf62 + 26a94d8 commit 8715c3c

File tree

4 files changed

+28
-13
lines changed

4 files changed

+28
-13
lines changed

adabot/circuitpython_libraries.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -242,10 +242,7 @@ def run_library_checks(validators, kw_args, error_depth):
242242
)
243243
for pull_request in sorted_prs:
244244
logger.info(" * %s", pull_request)
245-
print_issue_overview(lib_insights)
246-
logger.info("* https://circuitpython.org/contributing")
247-
logger.info(" * %s open issues", len(lib_insights["open_issues"]))
248-
logger.info(" * %s good first issues", lib_insights["good_first_issues"])
245+
249246
open_pr_days = [
250247
int(pr_sort_re.search(pull_request).group(1))
251248
for pull_request in lib_insights["open_prs"]
@@ -258,6 +255,14 @@ def run_library_checks(validators, kw_args, error_depth):
258255
max(open_pr_days),
259256
max((min(open_pr_days), 1)), # ensure the minumum is '1'
260257
)
258+
259+
print_issue_overview(lib_insights)
260+
261+
logger.info(" * %s open issues", len(lib_insights["open_issues"]))
262+
logger.info(" * %s good first issues", lib_insights["good_first_issues"])
263+
264+
logger.info("* https://circuitpython.org/contributing")
265+
261266
logger.info("Library updates in the last seven days:")
262267
if len(new_libs) != 0:
263268
logger.info("**New Libraries**")

adabot/lib/circuitpython_library_validators.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -236,13 +236,9 @@ def rtd_yml_base(self):
236236
if self._rtd_yaml_base is None:
237237
rtd_yml_dl_url = (
238238
"https://raw.githubusercontent.com/adafruit/cookiecutter-adafruit-"
239-
"circuitpython/main/%7B%25%20if%20cookiecutter.library_prefix"
240-
"%20%25%7D%7B%7B%20cookiecutter.library_prefix%20%7C%20capitalize"
241-
"%20%7D%7D_CircuitPython%7B%25%20else%20%25%7DCircuitPython_Org%7B"
242-
"%25%20endif%20%25%7D_%7B%7B%20cookiecutter.library_name%7Creplace"
243-
"(%22%20%22%2C%20%22_%22)%7D%7D/%7B%25%20if%20cookiecutter.sphinx"
244-
"_docs%20in%20%5B'y'%2C%20'yes'%5D%20%25%7D.readthedocs.yml%7B%25"
245-
"%20endif%20%25%7D"
239+
"circuitpython/main/%7B%7B%20cookiecutter%20and%20'tmp_repo'%20%7D"
240+
"%7D/%7B%25%20if%20cookiecutter.sphinx_docs%20in%20%5B'y'%2C%20'yes'"
241+
"%5D%20%25%7D.readthedocs.yml%7B%25%20endif%20%25%7D"
246242
)
247243
rtd_yml = requests.get(rtd_yml_dl_url)
248244
if rtd_yml.ok:

adabot/update_cp_org_libraries.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,9 +238,9 @@ def main(
238238
# get the contributors and reviewers for the last week
239239
get_contribs, get_revs, get_merge_count = get_contributors(repo)
240240
if get_contribs:
241-
contributors.add(get_contribs)
241+
contributors.update(get_contribs)
242242
if get_revs:
243-
reviewers.add(get_revs)
243+
reviewers.update(get_revs)
244244
merged_pr_count_total += get_merge_count
245245

246246
if repo_name in DO_NOT_VALIDATE:

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)