pymc-devs / pymc

Bayesian Modeling and Probabilistic Programming in Python
https://docs.pymc.io/
Other
8.67k stars 2k forks source link

`pymc.testing` attempts to import `pytest` but `pytest` is not in `pymc` install requirements #7218

Closed lucianopaz closed 3 months ago

lucianopaz commented 6 months ago

Describe the issue:

a41d5244b8ec78372751924ba0484ed02d57b2cb included the testing.py module at the root level of pymc. setup.py says that the install requires are taken from requirements.txt, and that file does not include pytest.

This makes from pymc.testing import anything fail unless you already have installed pytest. Should pymc raise some kind of informative message instead of saying ModuleNotFoundError: No module named 'pytest'?

Reproduceable code example:

from pymc import testing

Error message:

ModuleNotFoundError: No module named 'pytest'

PyMC version information:

pymc version: 5.11.0

Context for the issue:

No response

ricardoV94 commented 6 months ago

Maybe we should import pytest locally, because not everything in there requires it. We are only using pytest for the pytest.warns feature

lucianopaz commented 6 months ago

Yes, that's fine with me.

bomtall commented 3 months ago

I would like to take this (as part of the hackathon)