-
Notifications
You must be signed in to change notification settings - Fork 1
[Test] Make test_lazy happy
#19
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
…ft as an example module for test_lazy.
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.
Pull Request Overview
This PR fixes test failures in test_lazy.py caused by NumPy 2.0's removal of the deprecated numpy.compat module, adds Python version restrictions for the aim dependency which lacks Python 3.13 support, and improves the _is_builtin_module function to handle frozen modules in optimized Python distributions.
- Replaces
numpy.compatwithnumpy.fftin lazy import tests - Restricts
aimdependency to Python < 3.13 - Adds frozen module detection to
_is_builtin_module
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| tests/test_config/test_lazy.py | Updates test imports and assertions to use numpy.fft instead of deprecated numpy.compat |
| pyproject.toml | Adds Python version constraint to aim dependency for compatibility |
| mmengine/config/utils.py | Adds frozen module handling in _is_builtin_module function |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@lauriebax I'm creating this PR, as mentioned in open-mmlab/mmengine. I may create more when I have time. |
|
revert done |
|
We should squash this PR to keep the history clean |
|
I've copied your changes to #20 and fixed the pipeline to not break on outside PRs. So I'm closing the PR, thanks for your contribution! |
Error caused by the removal of
numpy.compatMotivation
According to https://numpy.org/devdocs/release/2.0.0-notes.html#deprecations,
np.compathas been deprecated, as Python 2 is no longer supported.This causes several failures in pytest:
tests/test_config/test_lazy.py. Fixing this issue now.Modification
test_lazy.pyutilizenumpy.compatas an example numpy module to test if the lazy import function can properly working. So simply replacing it with any other existing numpy module,numpy.fftfor this PR.aimdependencyCan't find a valid distribution for
aiminpython=3.13, so add python version check for this dependency.Improve
_is_builtin_moduleIn some optimized python version (e.g. conda-forge), the
oscan be a frozen module. In this case,_is_builtin_modulemalfunctioned and cause the above test fails. So adding an if-branch to handle this scenario.