Running pytest during Travis build fails with ModuleNotFoundError: No module named 'google'
vduseev opened this issue · comments
Vagiz Duseev commented
Summary
Running poetry run pytest
fails during build because GCP dependencies are not installed.
How to reproduce
- Clone repo
- Install dependencies using
poetry install -E yaml -E toml -E azure -E aws
(just like in.travis.yml
file) - Run
poetry run pytest
====================================== test session starts =======================================
platform darwin -- Python 3.8.5, pytest-5.4.3, py-1.9.0, pluggy-0.13.1
rootdir: /Users/vduseev/Projects/python-configuration, inifile: setup.cfg
plugins: flake8-1.0.6, mock-2.0.0, mypy-0.4.2, cov-2.10.1, black-0.3.11
collected 200 items / 1 error / 199 selected
Running mypy on 30 files... done with status 1
Found 56 errors in 1 file (checked 30 source files)
============================================= ERRORS =============================================
___________________________ ERROR collecting tests/contrib/test_gcp.py ___________________________
ImportError while importing test module '/Users/vduseev/Projects/python-configuration/tests/contrib/test_gcp.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
tests/contrib/test_gcp.py:4: in <module>
from google.api_core.exceptions import NotFound
E ModuleNotFoundError: No module named 'google'
==================================== short test summary info =====================================
ERROR tests/contrib/test_gcp.py
!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!
======================================== 1 error in 2.67s ========================================
What happens
google
module cannot be imported because it is not installed.
What should happen
- Successful import.
Fix suggestions
- Add
-E gcp
to.travis.yml
during dependency installation using poetry