-
Notifications
You must be signed in to change notification settings - Fork 4
Improvements to thread safety detection and implement disallowing whole modules #82
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
base: main
Are you sure you want to change the base?
Improvements to thread safety detection and implement disallowing whole modules #82
Conversation
Can you update the readme based on the new functionality? I'll try to take a look at the code ASAP. |
Do you have any idea why there are so many more scikit-learn tests getting collected? What's special about the 12 tests in SciPy that don't get collected anymore? |
All the code changes look reasonable to me and the new tests look like they're catching tricky corner cases along with just detecting that a module is imported. Maybe add a test to make sure that tests still run in parallel if they don't use any functionality from a blacklisted module? |
README updated.
The scikit-learn number was due to a bug after all. The
The SciPy and scikit-learn that now get skipped were false positives. The ones I had a look at had calls to functions that were importing a different way than what we had blocklisted (e.g. |
Thanks for looking at that! Making this stuff more robust will pay ecosystem-wide dividends. Does adding the test I suggested in my other comment make sense? |
Isn't this covered from all of the other tests (in files other than |
I don't think so. Or at least it's not obvious to me. I think you have to add a new test to the test file created by |
Done! |
I spent some time profiling this and I didn't see any obvious way to speed things up - now that the visitor is doing more stuff, it takes more time. We also spend a decent amount of time in |
@rgommers what do you think about the marginally increased collection time for SciPy? |
This includes a few things:
generic_visit
in all paths and bail out early when already thread unsafe__thread_safe__
ctypes
andunittest.mock
It's easier to review this commit by commit.
Also, here's the test results for
scipy
andscikit-learn
when it comes to collection performance:SciPy:
scikit-learn:
EDIT: Changed number of tests discovered to run in parallel under HEAD in scikit-learn.