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

Apparently Numpy dependency in diffusion-master tests #26

Closed
AdrianDAlessandro opened this issue Mar 3, 2022 · 3 comments
Closed

Apparently Numpy dependency in diffusion-master tests #26

AdrianDAlessandro opened this issue Mar 3, 2022 · 3 comments

Comments

@AdrianDAlessandro
Copy link
Contributor

There appears to be a Numpy dependency in pytest.approx(), which detracts from the actual error. This is happening in diffusion-master and making the assertion error confusing.

When there is an AssertionError while using pytest.approx() it tries to use Numpy to represent the error, so we get the expected AssertionError followed by a ModuleNotFoundError:

>       assert numerical_solution == pytest.approx(analytical_solution, abs=1e-2)
E       AssertionError: assert [0, 0.6701936...01229794, ...] == approx([0 ± 1... 0 ± 1.0e-02])
E         (pytest_assertion plugin: representation of details failed: /usr/local/Caskroom/miniconda/base/envs/diffusion/lib/python3.9/site-packages/_pytest/python_api.py:323: ModuleNotFoundError: No module named 'numpy'.
E          Probably an object has a faulty __repr__.)

This makes it appear like we should include Numpy in the requirements. Strictly speaking, the test does not need Numpy, but the error message needs it to display properly.

We should include Numpy to reduce confusion.

@dalonsoa
Copy link
Contributor

dalonsoa commented Mar 3, 2022

This looks to me like a bug in pytest. If Numpy is really a dependency for pytest, it should be installed when installing it. I'd suggest to report this to pytest developers in GitHub (or whatever they have their code).

@AdrianDAlessandro
Copy link
Contributor Author

I've raised it with pytest here pytest-dev/pytest#9726

@dalonsoa
Copy link
Contributor

Closed in pytest-dev/pytest#9798

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

No branches or pull requests

2 participants