I have a project with the following structure:
.
├── Pipfile
├── Pipfile.lock
├── rules
│ ├── __init__.py
│ ├── budget.py
│ └── tests
│ ├── __init__.py
│ └── budget_test.py
Obviously, the budget_test.py
is testing the budget.py
module.
from .. import budget
class TestBudget:
...
and the budget.py
starts with:
import pandas as pd
When I launch the module manually, the import runs fine. When I launch pytest, I get an ImportError about pandas:
ImportError: No module named pandas
En though the virtualenv is activated and pandas is part of the installed packages:
pip freeze
... pandas==1.0.1 ...
Is there any reason pytest cannot find the packages installed in the virtual environment?
Surprisingly, running pytest
fails when python -m pytest
is succesful