Skip to content

Running pytest during Travis build fails with ModuleNotFoundError: No module named 'google' #41

Closed
@vduseev

Description

@vduseev

Summary

Running poetry run pytest fails during build because GCP dependencies are not installed.

How to reproduce

  1. Clone repo
  2. Install dependencies using poetry install -E yaml -E toml -E azure -E aws (just like in .travis.yml file)
  3. 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

  1. google module cannot be imported because it is not installed.

What should happen

  1. Successful import.

Fix suggestions

  1. Add -E gcp to .travis.yml during dependency installation using poetry

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions