Skip to content

Commit

Permalink
Merge pull request #294 from tekktrik/dev/unique-rtd-errors
Browse files Browse the repository at this point in the history
Specify errors for docs validation
  • Loading branch information
kattni authored Sep 2, 2022
2 parents 7ce195f + 8e80e02 commit 51fe0e6
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions adabot/lib/circuitpython_library_validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,18 @@
ERROR_ONLY_ALLOW_MERGES = "Only allow merges, disallow rebase and squash"
ERROR_RTD_SUBPROJECT_MISSING = "ReadTheDocs missing as a subproject on CircuitPython"
ERROR_RTD_ADABOT_MISSING = "ReadTheDocs project missing adabot as owner"
ERROR_RTD_FAILED_TO_LOAD_BUILD_STATUS = "Failed to load RTD build status"
ERROR_RTD_FAILED_TO_LOAD_BUILD_STATUS = (
"Failed to load RTD build status (General error)"
)
ERROR_RTD_FAILED_TO_LOAD_BUILD_STATUS_GH_NONLIMITED = (
"Failed to load RTD build status (GitHub error)"
)
ERROR_RTD_FAILED_TO_LOAD_BUILD_STATUS_RTD_NONLIMITED = (
"Failed to load RTD build status (RTD error)"
)
ERROR_RTD_FAILED_TO_LOAD_BUILD_STATUS_RTD_UNEXPECTED_RETURN = (
"Failed to load RTD build status (Unknown error)"
)
ERROR_RTD_SUBPROJECT_FAILED = "Failed to list CircuitPython subprojects on ReadTheDocs"
ERROR_RTD_OUTPUT_HAS_WARNINGS = "ReadTheDocs latest build has warnings and/or errors"
ERROR_GITHUB_NO_RELEASE = "Library repository has no releases"
Expand Down Expand Up @@ -865,7 +876,7 @@ def validate_readthedocs(self, repo):
time.sleep(sleep_time.seconds)
continue
except pygithub.GithubException:
errors.append(ERROR_RTD_FAILED_TO_LOAD_BUILD_STATUS)
errors.append(ERROR_RTD_FAILED_TO_LOAD_BUILD_STATUS_GH_NONLIMITED)
return errors

readme_text = content_file.decoded_content.decode("utf-8")
Expand All @@ -890,7 +901,7 @@ def validate_readthedocs(self, repo):
if error_message == "Not found." or not error_message.startswith(
"Request was throttled."
):
errors.append(ERROR_RTD_FAILED_TO_LOAD_BUILD_STATUS)
errors.append(ERROR_RTD_FAILED_TO_LOAD_BUILD_STATUS_RTD_NONLIMITED)
return errors
time_result = parse.search(
"Request was throttled. Expected available in {throttled:d} seconds.",
Expand All @@ -903,7 +914,7 @@ def validate_readthedocs(self, repo):
# Return the results of the latest run
doc_build_results = json_response.get("results")
if doc_build_results is None:
errors.append(ERROR_RTD_FAILED_TO_LOAD_BUILD_STATUS)
errors.append(ERROR_RTD_FAILED_TO_LOAD_BUILD_STATUS_RTD_UNEXPECTED_RETURN)
return errors
result = doc_build_results[0].get("success")
time.sleep(3)
Expand Down

0 comments on commit 51fe0e6

Please sign in to comment.