-
Notifications
You must be signed in to change notification settings - Fork 329
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
update ReadTheDocs settings file #2083
Merged
+59
−26
Merged
Changes from 1 commit
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
c1130c5
update RTD config
drammock d357357
rename file
drammock 813b30e
Update .readthedocs.yaml
drammock 90a5322
Update .readthedocs.yaml
drammock e11d83b
Revert "Update .readthedocs.yaml"
drammock 9049650
try installing deps with apt
drammock 4396f95
use nitpicky
drammock 55389e4
minor cleanup
drammock 071317b
remove the custom warnings checker
drammock b3addeb
flesh out nitpicky ignores
drammock ce874ec
Revert "remove the custom warnings checker"
drammock e5edd7d
fixed nitpicky
drammock e24a735
don't fail RTD on warning
drammock 8e6d749
toxfile: build w/ nitpicky; show full traceback on fail
drammock File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Revert "remove the custom warnings checker"
This reverts commit 071317b.
commit ce874ecced111ddfa4fcfe16b1547bd962fdc4db
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
"""Check the list of warnings produced by a doc build.""" | ||
|
||
import sys | ||
|
||
from pathlib import Path | ||
|
||
from colorama import Fore, init | ||
|
||
from pydata_sphinx_theme.utils import escape_ansi | ||
|
||
|
||
# init colors for all plateforms | ||
init() | ||
|
||
|
||
def check_warnings(file: Path) -> bool: | ||
"""Check the list of warnings produced by a doc build. | ||
|
||
Raise errors if there are unexpected ones and/or if some are missing. | ||
|
||
Parameters: | ||
file: the path to the generated warning.txt file from | ||
the CI build | ||
|
||
Returns: | ||
0 if the warnings are all there | ||
1 if some warning are not registered or unexpected | ||
""" | ||
# print some log | ||
print("\n=== Sphinx Warnings test ===\n") | ||
|
||
# find the file where all the known warnings are stored | ||
warning_file = Path(__file__).parents[1] / "warning_list.txt" | ||
extra_warning_file = Path(__file__).parents[1] / "intermittent_warning_list.txt" | ||
|
||
received_warnings = escape_ansi(file.read_text()).strip().split("\n") | ||
expected_warnings = warning_file.read_text().strip().split("\n") | ||
intermittent_warnings = extra_warning_file.read_text().strip().split("\n") | ||
# filter out empty warnings (happens on notebooks for some reason) | ||
received_warnings = list(filter(len, received_warnings)) | ||
|
||
print( | ||
f'Checking build warnings in file: "{file}" and comparing to expected ' | ||
f'warnings defined in "{warning_file}" and "{extra_warning_file}"\n\n' | ||
) | ||
|
||
for exp_w in expected_warnings[::-1] + intermittent_warnings[::-1]: | ||
found = False | ||
for rec_w in received_warnings: | ||
if exp_w in rec_w: | ||
received_warnings.remove(rec_w) | ||
if exp_w in expected_warnings: | ||
expected_warnings.remove(exp_w) | ||
elif exp_w in intermittent_warnings: | ||
intermittent_warnings.remove(exp_w) | ||
found = True | ||
break | ||
# alert only if an *always expected* warning wasn't raised (not intermittent) | ||
if not found and exp_w not in intermittent_warnings: | ||
print(f"{Fore.YELLOW}Warning was not raised: {Fore.RESET}{exp_w}\n") | ||
# warn about unexpected warnings | ||
for rec_w in received_warnings[::-1]: | ||
print(f"{Fore.YELLOW}Unexpected warning: {Fore.RESET}{rec_w}\n") | ||
return len(received_warnings) or len(expected_warnings) | ||
|
||
|
||
if __name__ == "__main__": | ||
# cast the file to path and resolve to an absolute one | ||
file = Path.cwd() / "warnings.txt" | ||
|
||
# execute the test | ||
sys.exit(check_warnings(file)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unrelated simplification, noticed in passing