-
Notifications
You must be signed in to change notification settings - Fork 429
TST Fix test_nested_parallel_warnings_parent_backend for Python nogil #1394
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
Conversation
Codecov ReportBase: 93.32% // Head: 94.04% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## master #1394 +/- ##
==========================================
+ Coverage 93.32% 94.04% +0.71%
==========================================
Files 52 52
Lines 7300 7343 +43
==========================================
+ Hits 6813 6906 +93
+ Misses 487 437 -50
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
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.
LGTM. I confirm that this patch makes the failing tests pass when using nogil
.
Thank you, @lesteve.
joblib/test/test_parallel.py
Outdated
# when the outer backend is threading and with nogil, we might see | ||
# more that one warning | ||
warnings_have_the_right_length = ( | ||
len(warninfo) >= 1 if getattr(sys.flags, 'nogil', False) | ||
else len(warninfo) == 1) |
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.
When reading this comment, nogil
can be thought as a nogil
-Cython context, and not as the eponymous fork of CPython.
Does this makes this adaptation slightly clearer?
# when the outer backend is threading and with nogil, we might see | |
# more that one warning | |
warnings_have_the_right_length = ( | |
len(warninfo) >= 1 if getattr(sys.flags, 'nogil', False) | |
else len(warninfo) == 1) | |
# When the outer backend is threading and when one uses nogil | |
# (the fork of CPython), we might observe more that one warning. | |
python_interpreter_is_nogil = getattr(sys.flags, 'nogil', False) | |
n_warnings = len(warninfo) | |
warnings_have_the_right_length = ( | |
n_warnings >= 1 if python_interpreter_is_nogil | |
else n_warnings == 1 | |
) |
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.
I tweak the wording to use "Python nogil" I guess this is good enough
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.
LGTM! thx @lesteve
Another fix for making the test pass with Python nogil