Skip to content

Commit 08a7fcf

Browse files
committed
Oops, set the CI environment variable even earlier.
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.
1 parent f42fcaa commit 08a7fcf

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

tests/conftest.py

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
import pytest
22
import os
33

4+
# Note that we have to do this *before* `pipenv.environments` gets imported,
5+
# which is why we're doing it here as a side effect of importing this module.
6+
# CI=1 is necessary as a workaround for https://github.com/pypa/pipenv/issues/4909
7+
os.environ['CI'] = '1'
8+
49
def pytest_sessionstart(session):
5-
# CI=1 is necessary as a workaround for https://github.com/pypa/pipenv/issues/4909
6-
os.environ['CI'] = '1'
10+
import pipenv.environments
11+
assert pipenv.environments.PIPENV_IS_CI
712

813

914
@pytest.fixture()

0 commit comments

Comments
 (0)