Skip to content

run in pipenv created venv #8

@ahonnecke

Description

@ahonnecke

apologies I'm missing something (I'm quite new to python), but I cannot figure out how to run this in a pipenv environment. I have done pyenv-workon and selected an environment

I set the pythong pytest executable to "pipenv run py.test"
(I also tried pointing it to the venv)

From the command line

web on  pytest-in-ci [⇡$!] via 🐍 system took 4s
➜ pipenv run py.test --color=no 'server/dad/tests/test_graphql_auth.py::TestGraphQL::test_device_params'
======================================================================================== test session starts ========================================================================================
platform darwin -- Python 3.6.5, pytest-3.5.1, py-1.5.3, pluggy-0.6.0
Django settings: dad.settings (from environment variable)
rootdir: /Users/ahonnecke/Code/repos/web/server, inifile: pytest.ini
plugins: env-0.6.2, django-3.1.2
collected 1 item

server/dad/tests/test_graphql_auth.py .                                                                                                                                                       [100%]

===================================================================================== 1 passed in 1.19 seconds ======================================================================================

web on  pytest-in-ci [⇡$] via 🐍 system took 4s

From the popup:

cwd: /Users/ahonnecke/Code/repos/web/
cmd: pipenv run py.test --color=no 'server/dad/tests/test_graphql_auth.py::TestGraphQL::test_device_params'

Courtesy Notice: Pipenv found itself running within a virtual environment, so it will automatically use that environment, instead of creating its own for any project.
====================================== test session starts =======================================
platform darwin -- Python 3.6.5, pytest-3.5.1, py-1.5.3, pluggy-0.6.0
rootdir: /Users/ahonnecke/Code/repos/web/server, inifile: pytest.ini
collecting 0 items / 1 errors                                                                    
============================================= ERRORS =============================================
________________________ ERROR collecting dad/tests/test_graphql_auth.py _________________________
ImportError while importing test module '/Users/ahonnecke/Code/repos/web/server/dad/tests/test_graphql_auth.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
server/dad/tests/test_graphql_auth.py:6: in <module>
    from dad.schema import schema
server/dad/schema.py:4: in <module>
    from django.utils import timezone
E   ModuleNotFoundError: No module named 'django'
==================================== 1 error in 0.06 seconds =====================================
ERROR: not found: /Users/ahonnecke/Code/repos/web/server/dad/tests/test_graphql_auth.py::TestGraphQL::test_device_params
(no name '/Users/ahonnecke/Code/repos/web/server/dad/tests/test_graphql_auth.py::TestGraphQL::test_device_params' in any of [<Module 'dad/tests/test_graphql_auth.py'>])
¯

I have django installed in the pipenv shell, but not locally

Metadata

Metadata

Assignees

Labels

invalidThis doesn't seem rightquestionFurther information is requested

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions