Skip to content

Commit 40ba073

Browse files
authored
Run the plugin as early as possible
This is required when other plugins (e.g. pytest-django) need to access environment variables set by this plugin. Fixes #3.
1 parent 2a40d55 commit 40ba073

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

pytest_env/plugin.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import os
22

3+
import pytest
4+
35

46
def pytest_addoption(parser):
57
parser.addini("env",
@@ -8,6 +10,7 @@ def pytest_addoption(parser):
810
default=[])
911

1012

13+
@pytest.hookimpl(tryfirst=True)
1114
def pytest_load_initial_conftests(args, early_config, parser):
1215
for e in early_config.getini("env"):
1316
part = e.partition("=")

0 commit comments

Comments
 (0)