mirror of
https://github.com/kennethreitz/pipenv.git
synced 2026-06-05 06:46:15 +00:00
08a7fcf1cd
If I do something like `pytest tests/integration/test_cli.py`, something about the ordering of imports means that `pipenv.environments` gets loaded *before* `pytest_sessionstart` runs, which means that `pipenv.environments.PIPENV_IS_CI` ends up false.
18 lines
491 B
Python
18 lines
491 B
Python
import pytest
|
|
import os
|
|
|
|
# Note that we have to do this *before* `pipenv.environments` gets imported,
|
|
# which is why we're doing it here as a side effect of importing this module.
|
|
# CI=1 is necessary as a workaround for https://github.com/pypa/pipenv/issues/4909
|
|
os.environ['CI'] = '1'
|
|
|
|
def pytest_sessionstart(session):
|
|
import pipenv.environments
|
|
assert pipenv.environments.PIPENV_IS_CI
|
|
|
|
|
|
@pytest.fixture()
|
|
def project():
|
|
from pipenv.project import Project
|
|
return Project()
|