-
Notifications
You must be signed in to change notification settings - Fork 6.1k
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
[Draft] [Fail on pytest warnings 2/n] Failing on pytest warnings #31219
Conversation
d593ee8
to
8149c8a
Compare
note to self: there seem to be a good bit more warnings than I expected. I might have to put all of them into the pytest.ini at high level and leave for future prioritization instead of fixing in each test |
d2620cb
to
977404a
Compare
bfb66fb
to
e6d8594
Compare
…uences as raw strings (#31523) Background Python deprecated invalid unicode escape sequences a while back (Python3.6) and they will start breaking in newer Pythons: Changed in version 3.6: Unrecognized escape sequences produce a DeprecationWarning. In a future Python version they will be a SyntaxWarning and eventually a SyntaxError. Docstrings and other strings that need \ et al. should be raw strings. Pytest? For reasons unclear to me, pytest encounters the SyntaxError when it instruments tests with improved assertions when its warnings are interpreted as failures. It's unclear how to ignore them (because they're marked as SyntaxErrors, which aren't warnings and can't be filtered). So, in this PR we fix the occurrences where we have invalid escape sequences. We have to do it in a separate PR from #31219 because our CI is using a prebuilt wheel instead of a per-PR wheel. #31479 tracks the work to fail on pytest warnings. Example offenders For example, see lines 406, 407, 412, and 413 here: ray/python/ray/data/grouped_dataset.py Lines 406 to 413 in 0c8b59d ... for i in range(100)]) \ # doctest: +SKIP ... .groupby(lambda x: x[0] % 3) \ # doctest: +SKIP ... .sum(lambda x: x[2]) # doctest: +SKIP >>> ray.data.range_table(100).groupby("value").sum() # doctest: +SKIP >>> ray.data.from_items([ # doctest: +SKIP ... {"A": i % 3, "B": i, "C": i**2} # doctest: +SKIP ... for i in range(100)]) \ # doctest: +SKIP ... .groupby("A") \ # doctest: +SKIP Signed-off-by: Cade Daniel <cade@anyscale.com>
d36bc87
to
d7e9430
Compare
…uences as raw strings (#31523) Background Python deprecated invalid unicode escape sequences a while back (Python3.6) and they will start breaking in newer Pythons: Changed in version 3.6: Unrecognized escape sequences produce a DeprecationWarning. In a future Python version they will be a SyntaxWarning and eventually a SyntaxError. Docstrings and other strings that need \ et al. should be raw strings. Pytest? For reasons unclear to me, pytest encounters the SyntaxError when it instruments tests with improved assertions when its warnings are interpreted as failures. It's unclear how to ignore them (because they're marked as SyntaxErrors, which aren't warnings and can't be filtered). So, in this PR we fix the occurrences where we have invalid escape sequences. We have to do it in a separate PR from #31219 because our CI is using a prebuilt wheel instead of a per-PR wheel. #31479 tracks the work to fail on pytest warnings. Example offenders For example, see lines 406, 407, 412, and 413 here: ray/python/ray/data/grouped_dataset.py Lines 406 to 413 in 0c8b59d ... for i in range(100)]) \ # doctest: +SKIP ... .groupby(lambda x: x[0] % 3) \ # doctest: +SKIP ... .sum(lambda x: x[2]) # doctest: +SKIP >>> ray.data.range_table(100).groupby("value").sum() # doctest: +SKIP >>> ray.data.from_items([ # doctest: +SKIP ... {"A": i % 3, "B": i, "C": i**2} # doctest: +SKIP ... for i in range(100)]) \ # doctest: +SKIP ... .groupby("A") \ # doctest: +SKIP Signed-off-by: Cade Daniel <cade@anyscale.com>
2f32407
to
13f0d90
Compare
@@ -331,6 +331,7 @@ def test_no_auto_init(shutdown_only): | |||
assert not ray.is_initialized() | |||
|
|||
|
|||
@pytest.mark.filterwarnings("default") |
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.
do I still need this?
b159944
to
07fd7b7
Compare
07fd7b7
to
cf2abc2
Compare
Config file syntax error Fixing bugs, consolidating Fixing regex bugs, adding comments more bugfixes comment Temporarily disabling tests which invoke warnings API in case they're disabling pytest.ini Fixing regex bugs Documenting failures Noting pytest warning sources so we can triage Revert "Temporarily disabling tests which invoke warnings API in case they're disabling pytest.ini" This reverts commit b845842. More ignores Comment Attempt to ignore ResourceWarning Fixes Skipping warnings in test_cli More warnings WIP Marwil raw string More warnings Comment to trigger cpp build Fixes Try to force full build with noop requirements.txt change Two more warnings Fix Syntax fix More warnings ignore Try suppress runtime env warn More warnings Hack to unsupress annotation warnings Revert "Hack to unsupress annotation warnings" This reverts commit be28de3d010611204591e8636b28937c4e227649. Hack to get around deprecated warning recently added More raw string conversions Revert "Hack to get around deprecated warning recently added" This reverts commit 2eec2c1691cffb359e344c7ad772147b3d5b4531. Ray dep annotation fix More warnings Fixes Fixes Fixes Fixes Fixes Fixes Fixes Fix Lint Fix Fix Fixes fix
5b1a4de
to
3b25e95
Compare
I think this is a very important thing that should be merged ASAP. |
Background
As part of #31479, we will fail CI on pytest warnings. This will help us catch deprecations earlier and improve test hygiene. In order to do so, we need to first whitelist existing warnings so we can fix them incrementally.
Closes #31479
Further Context: https://docs.google.com/document/d/1TVMfmhO0vD1MdkVrqRS9t4om2shMTY9nqdqqOopNv0M/edit#
Remaining steps:
ignore:RuntimeError:Maybe you called ray.init twice by accident?:RuntimeError
DeprecationWarning: crc32c.crc32 will be eventually removed, use crc32c.crc32c instead
PytestUnhandledCoroutineWarning
) (they are :/)terminate called after throwing an instance of 'std::bad_alloc'
in //python/ray/train:distributed_sage_example