fix(tests): set OPENCV_IO_ENABLE_OPENEXR in conftest#232
Open
mountarreat wants to merge 1 commit intonikopueringer:mainfrom
Open
fix(tests): set OPENCV_IO_ENABLE_OPENEXR in conftest#232mountarreat wants to merge 1 commit intonikopueringer:mainfrom
mountarreat wants to merge 1 commit intonikopueringer:mainfrom
Conversation
pyproject.toml declared `env = ["OPENCV_IO_ENABLE_OPENEXR=1"]` under [tool.pytest.ini_options], but that option requires the pytest-env plugin and that plugin is not in the dev dependency group. Pytest therefore emitted `PytestConfigWarning: Unknown config option: env` on every run and the config declaration never actually exported the variable. Replace the inert config line with an os.environ.setdefault call at the top of tests/conftest.py, after imports. OpenCV reads the flag at import time, and conftest.py only imports cv2 inside two fixtures, so the setdefault runs before any test module brings cv2 in. setdefault is used so the workflow-level export in .github/workflows/ci.yml is preserved unchanged. No new dependencies are added. Verified locally on Windows with Python 3.13.11: - uv run ruff format --check: clean - uv run ruff check: clean - uv run pytest -v --tb=short -m "not gpu" with OPENCV_IO_ENABLE_OPENEXR explicitly unset in the shell: 363 passed, 1 skipped (MLX), 4 deselected (GPU), 1 warning. The unknown-option warning is gone; the remaining warning is an unrelated torch autocast note. - uv run corridorkey --help: exits 0.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this change?
pyproject.tomlsetsenv = ["OPENCV_IO_ENABLE_OPENEXR=1"]under[tool.pytest.ini_options], but that option requires thepytest-envplugin, which is not in the dev dependency group. Pytest emits
PytestConfigWarning: Unknown config option: envon every run and theenv var is never actually exported by the config declaration.
This PR replaces the inert config line with
os.environ.setdefault("OPENCV_IO_ENABLE_OPENEXR", "1")at the top oftests/conftest.py(after imports). OpenCV reads the flag at importtime, and
conftest.pyonly importscv2inside two fixtures, so thesetdefaultruns before any test module bringscv2in.setdefaultpreserves the existing workflow-level export in
.github/workflows/ci.yml. No new dependencies are added.How was it tested?
Locally on Windows with Python 3.13.11 (
uv sync --group dev), withOPENCV_IO_ENABLE_OPENEXRexplicitlyunsetin the shell so theconftest fix has to stand on its own:
uv run ruff format --check: 43 files cleanuv run ruff check: all checks passeduv run pytest -v --tb=short -m "not gpu": 363 passed, 1 skipped(MLX), 4 deselected (GPU), 1 warning. The
Unknown config option: envwarning is gone; the remaining warning is an unrelated torch autocast
note on a no-CUDA machine.
uv run corridorkey --help: exits 0Checklist
uv run pytestpassesuv run ruff checkpassesuv run ruff format --checkpasses