Skip to content

Commit 3db5198

Browse files
authored
conftest.py must handles TEST_LIBRARY value (#5593)
1 parent c81c019 commit 3db5198

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

conftest.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,9 @@ def pytest_configure(config: pytest.Config) -> None:
159159
if not config.option.force_execute and "SYSTEM_TESTS_FORCE_EXECUTE" in os.environ:
160160
config.option.force_execute = os.environ["SYSTEM_TESTS_FORCE_EXECUTE"].strip().split(",")
161161

162+
if not config.option.library and "TEST_LIBRARY" in os.environ:
163+
config.option.library = os.environ["TEST_LIBRARY"].strip()
164+
162165
# clean input
163166
config.option.force_execute = [item.strip() for item in config.option.force_execute if len(item.strip()) != 0]
164167

utils/_context/_scenarios/parametric.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -130,12 +130,10 @@ def parametrized_tests_metadata(self):
130130
return self._parametric_tests_confs
131131

132132
def configure(self, config: pytest.Config):
133-
if config.option.library:
134-
library = config.option.library
135-
elif "TEST_LIBRARY" in os.environ:
136-
library = os.getenv("TEST_LIBRARY")
137-
else:
138-
pytest.exit("No library specified, please set -L option", 1)
133+
if not config.option.library:
134+
pytest.exit("No library specified, please set -L option or use TEST_LIBRARY env var", 1)
135+
136+
library: str = config.option.library
139137

140138
# get tracer version info building and executing the ddtracer-version.docker file
141139

0 commit comments

Comments
 (0)