astropy: quantity_allclose can not be imported without pytest installed

>>> from astropy.tests.helper import quantity_allclose
  File "/opt/miniconda/envs/clean/lib/python3.6/site-packages/astropy/tests/helper.py", line 14, in <module>
    import pytest
ModuleNotFoundError: No module named 'pytest'

Is this a recent change? I feel these “all close” helpers should be somewhere else? I am happy to PR this if people agree.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 1
  • Comments: 17 (17 by maintainers)

Commits related to this issue

Most upvoted comments

quantity_allclose should actually be moved to units (not utils) if you want to move it anywhere.

Although, I wonder we should leave a assert_quantity_allclose in the test helper, to be analogous with numpy.testing. 🤔

Try 3.0.2 or later.

@pllim i did deprecate the function but the import pytest command is still there and still gives the error

>>> from astropy.tests.helper import quantity_allclose
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/rohan/gsoc/astropy/astropy/tests/helper.py", line 13, in <module>
    import pytest
ImportError: No module named 'pytest'

I tried finding the pytest file and it seems be somewhere else ,not in the same folder as helper.py

@mhvk I have successfully moved the quantity_allclose to quantity.py and the command astropy.units.quantity import quantity_allclose passes without any errors or warnings

@rohanrajpal - If it’s related to this issues, it’s best to keep it in here. If it’s related on setting up the developer environment, etc, you may want to ask on the slack channel or here.

I’ll take this up.This would be my first bug fix, so would take a little more time than usual simple fixes take.