You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I'm trying to run the test suite using pytest against an editable installation of pyWavelets/pywt, and it looks like the PytestTester class in the pywt/_pytesttester.py module is not configured to run against on editable installations (with the -e . command-line flag) in the same way it seems to run in CI for non-editable installations (pip install .)
MWE, i.e., steps to reproduce
In a terminal, run
pip install numpy==1.23.3 cython meson-python # Python 3.11, build-time requirements sourced from the build-system table in pyproject.toml
pip install -e .
pip install pytest
and then,
pytest --pyargs pywt does not work and returns the following trace:
Expand to view logs
====================================================================== test session starts ======================================================================
platform darwin -- Python 3.11.7, pytest-8.0.1, pluggy-1.4.0
rootdir: /Users/agriyakhetarpal/Desktop/Work/pywt
configfile: pytest.ini
collected 0 items / 1 error
============================================================================ ERRORS =============================================================================
_______________________________________________________________ ERROR collecting pywt/__init__.py _______________________________________________________________
venv/lib/python3.11/site-packages/pluggy/_hooks.py:501: in __call__
return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
firstresult = True
kwargs = {'collector': <Module __init__.py>, 'name': 'test', 'obj': <pywt._pytesttester.PytestTester object at 0x1068ad7d0>}
self = <HookCaller 'pytest_pycollect_makeitem'>
venv/lib/python3.11/site-packages/pluggy/_manager.py:119: in _hookexec
return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
firstresult = True
hook_name = 'pytest_pycollect_makeitem'
kwargs = {'collector': <Module __init__.py>, 'name': 'test', 'obj': <pywt._pytesttester.PytestTester object at 0x1068ad7d0>}
methods = [<HookImpl plugin_name='python', plugin=<module '_pytest.python' from '/Users/agriyakhetarpal/Desktop/Work/pywt/venv/l...test.unittest' from '/Users/agriyakhetarpal/Desktop/Work/pywt/venv/lib/python3.11/site-packages/_pytest/unittest.py'>>]
self = <_pytest.config.PytestPluginManager object at 0x105633550>
venv/lib/python3.11/site-packages/_pytest/python.py:260: in pytest_pycollect_makeitem
warnings.warn_explicit(
E pytest.PytestCollectionWarning: cannot collect 'test' because it is not a function.
collector = <Module __init__.py>
filename = PosixPath('/Users/agriyakhetarpal/Desktop/Work/pywt/pywt/_pytesttester.py')
lineno = 72
name = 'test'
obj = <pywt._pytesttester.PytestTester object at 0x1068ad7d0>
==================================================================== short test summary info ====================================================================
ERROR pywt/__init__.py - pytest.PytestCollectionWarning: cannot collect 'test' because it is not a function.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
With pywt.test(), there is another error on editable installations:
113importpytest115module=sys.modules[self.module_name]
-->116module_path=os.path.abspath(module.__path__[0])
118# setup the pytest arguments119pytest_args= ["-l"]
IndexError: listindexoutofrange
Workarounds
However, for now,
pytest .,
pytest pywt
seem to work as usual and proceed with the collection of 1036 tests in total. These commands have been tested in a fresh, virtualenv-based virtual environment with Python 3.11.7 on a macOS M-series machine.
Additional notes
The bug seems to be coming from the --pyargs configuration in pywt/_pytesttester.py here:
which I'm not totally sure about, but it seems to be searching for test inside pywt/__init__.py as an importable Python module – while it is an instance of the PytestTester class.
The text was updated successfully, but these errors were encountered:
Thanks for the report @agriyakhetarpal. I believe the second error (IndexError from pywt.test()) will be resolved by mesonbuild/meson-python#569. Could you please confirm that?
Description
Hi, I'm trying to run the test suite using
pytest
against an editable installation of pyWavelets/pywt
, and it looks like thePytestTester
class in thepywt/_pytesttester.py
module is not configured to run against on editable installations (with the-e .
command-line flag) in the same way it seems to run in CI for non-editable installations (pip install .
)MWE, i.e., steps to reproduce
In a terminal, run
and then,
pytest --pyargs pywt
does not work and returns the following trace:Expand to view logs
With
pywt.test()
, there is another error on editable installations:Workarounds
However, for now,
pytest .
,pytest pywt
seem to work as usual and proceed with the collection of 1036 tests in total. These commands have been tested in a fresh,
virtualenv
-based virtual environment with Python 3.11.7 on a macOS M-series machine.Additional notes
The bug seems to be coming from the
--pyargs
configuration inpywt/_pytesttester.py
here:pywt/pywt/_pytesttester.py
Lines 150 to 156 in e69b126
which I'm not totally sure about, but it seems to be searching for
test
insidepywt/__init__.py
as an importable Python module – while it is an instance of thePytestTester
class.The text was updated successfully, but these errors were encountered: