Skip to content

Commit

Permalink
Oops, set the CI environment variable even earlier.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jfly committed Jan 7, 2022
1 parent f42fcaa commit 08a7fcf
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
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):
# CI=1 is necessary as a workaround for https://github.com/pypa/pipenv/issues/4909
os.environ['CI'] = '1'
import pipenv.environments
assert pipenv.environments.PIPENV_IS_CI


@pytest.fixture()
Expand Down

0 comments on commit 08a7fcf

Please sign in to comment.