Skip to content
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

Tests with scipy.spatial.Delaunay being skipped #3431

Closed
sukrutakolkar opened this issue Dec 24, 2024 · 2 comments · Fixed by #3433
Closed

Tests with scipy.spatial.Delaunay being skipped #3431

sukrutakolkar opened this issue Dec 24, 2024 · 2 comments · Fixed by #3433

Comments

@sukrutakolkar
Copy link

Description

Some test cases under test_sphere.py with a dependency on scipy.spatial.Delaunay are being skipped regardless of the dependency being satisfied. This is because the optional package check ( optional_package("scipy.spatial.Delaunay") ) internally uses importlib.import_module() to check if the dependency is satisfied. But since scipy.spatial.Delaunay is a class and not a module, it throws a ModuleNotFoundError and fails.

Way to reproduce

  • Code example
>>> import scipy.spatial.Delaunay
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'scipy.spatial.Delaunay'
>>> importlib.import_module('scipy.spatial.Delaunay')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\sukru\miniconda3\envs\tf\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 984, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'scipy.spatial.Delaunay'
>>> from scipy.spatial import Delaunay  
# works
>>> module = importlib.import_module("scipy.spatial")
>>> hasattr(module, "Delaunay")
True
  • Operating system and version: Windows-10-10.0.22631-SP0
  • Python version: 3.10.11 (tags/v3.10.11:7d4cc5a, Apr 5 2023, 00:38:17) [MSC v.1929 64 bit (AMD64)]
  • dipy version: 1.10.0
  • scipy version: 1.13.1
Copy link

Thank you for contributing an issue !

We are glad that you are finding DIPY useful !

This is an automatic message. Allow for time for DIPY maintainers to be able to read the issue and comment on it.

If asking for help or advice, please move the issue to the Discussions section: issues are intended to request new features or to report bugs.

We would appreciate if you took the time to submit a pull request to fix this issue should it happen to be one.

Please read our CODE OF CONDUCT and our CONTRIBUTING guidelines if you have not done that already 📖.

@skoudoro
Copy link
Member

Thank you for catching that, we need a quick fix.

Do you want to give it a try for your first contribution @sukrutakolkar?

Let us know if you need help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants