-
Notifications
You must be signed in to change notification settings - Fork 342
ignore transient errors in windows build CI #1520
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
Merged
Merged
Changes from 18 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
8f1a6b8
use warning list
drammock 6c29fe5
clean up notebook
drammock befd018
refactor to pass on all platforms?
drammock d55bc01
simplify
drammock a70dda4
fix logic
drammock 073b70b
iterate backwards
drammock 57d2d83
fix plaform detection? also don't log unnecessarily[H
drammock 76ddaeb
ignore empty string warnings
drammock 42f4672
remove notebook metawarning
drammock 4e8e303
Revert "remove notebook metawarning"
drammock 6fc35bb
try again
drammock 2840654
debug the mysterious empty warning
drammock c8b187f
escape color codes
drammock bc76f51
import
drammock e8298af
triage by intermittency, not by platform; better var names
drammock 1241793
simplify
drammock 447f39e
fix list.remove
drammock 4267474
undo what I broke
drammock 6c9cc89
Update tests/utils/check_warnings.py
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
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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,2 @@ | ||
WARNING: Cell printed to stderr: | ||
Matplotlib is building the font cache; this may take a moment. |
This file contains hidden or 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
This file contains hidden or 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 |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
from pathlib import Path | ||
|
||
from colorama import Fore, init | ||
from pydata_sphinx_theme.utils import escape_ansi | ||
|
||
# init colors for all plateforms | ||
init() | ||
|
@@ -27,30 +28,37 @@ def check_warnings(file: Path) -> bool: | |
|
||
# find the file where all the known warnings are stored | ||
warning_file = Path(__file__).parent.parent / "warning_list.txt" | ||
extra_warning_file = Path(__file__).parent.parent / "intermittent_warning_list.txt" | ||
|
||
test_warnings = file.read_text().strip().split("\n") | ||
ref_warnings = warning_file.read_text().strip().split("\n") | ||
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 = filter(len, received_warnings) | ||
|
||
print( | ||
f'Checking build warnings in file: "{file}" and comparing to expected ' | ||
f'warnings defined in "{warning_file}"\n\n' | ||
f'warnings defined in "{warning_file}" and "{extra_warning_file}"\n\n' | ||
) | ||
|
||
# find all the missing warnings | ||
missing_warnings = [] | ||
for wa in ref_warnings: | ||
index = [i for i, twa in enumerate(test_warnings) if wa in twa] | ||
if len(index) == 0: | ||
missing_warnings += [wa] | ||
print(f"{Fore.YELLOW}Warning was not raised: {Fore.RESET}{wa}\n") | ||
else: | ||
test_warnings.pop(index[0]) | ||
|
||
# the remaining one are unexpected | ||
for twa in test_warnings: | ||
print(f"{Fore.YELLOW}Unexpected warning: {Fore.RESET}{twa}\n") | ||
|
||
return len(missing_warnings) != 0 or len(test_warnings) != 0 | ||
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: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I really like this approach of checking presence but discarding absence. nice trick |
||
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__": | ||
|
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.
Uh oh!
There was an error while loading. Please reload this page.