Summary
I am currently packaging the scikit-hep stack for Guix, and I am facing troubles enabling the tests for the basic set of dependencies.
It looks like despite calling pytest with the only_numpy marker, it tries to load the other backends:
tests/conftest.py:63: in <module>
(pyhf.tensor.pytorch_backend(), None),
^^^^^^^^^^^^^^^^^^^^^^^^^^^
/gnu/store/jabv9192g9pi22w6cn6zwf57ajk8jm80-python-pyhf-0.7.6/lib/python3.11/site-packages/pyhf/tensor/__init__.py:54: in __getattr__
raise exceptions.ImportBackendError(
E pyhf.exceptions.ImportBackendError: ('There was a problem importing PyTorch. The pytorch backend cannot be used.', ModuleNotFoundError("No module named 'torch'"))
I did a quick review of the code in conftest.py, and indeed the backend fixture calls pyhf.set_backend(...) for the whole parameter set, irrespective of whether they are excluded via skip_$backend or only_$backend.
It would be nice if such behaviour could be changed to only call pyhf.set_backend("numpy") if -m only_numpy is specified.
Cheers,
Additional Information
Code of Conduct
Summary
I am currently packaging the
scikit-hepstack for Guix, and I am facing troubles enabling the tests for the basic set of dependencies.It looks like despite calling pytest with the
only_numpymarker, it tries to load the other backends:I did a quick review of the code in
conftest.py, and indeed the backend fixture callspyhf.set_backend(...)for the whole parameter set, irrespective of whether they are excluded viaskip_$backendoronly_$backend.It would be nice if such behaviour could be changed to only call
pyhf.set_backend("numpy")if-m only_numpyis specified.Cheers,
Additional Information
Code of Conduct