Skip to content

fix(dev): add pytest-env so OPENCV_IO_ENABLE_OPENEXR is set in local pytest runs #242

Closed

Description

@alexandremendoncaalvaro

Problem

pyproject.toml has:

```toml
[tool.pytest.ini_options]
env = ["OPENCV_IO_ENABLE_OPENEXR=1"]
```

…but the `env` key is provided by the `pytest-env` plugin, which is not in `[dependency-groups].dev`. So locally pytest emits:

```
PytestConfigWarning: Unknown config option: env
```

…and any test that hits `cv2.imwrite(*.exr)` before `clip_manager.py` (which sets the env var at import time) fails with:

```
cv2.error: imgcodecs: OpenEXR codec is disabled. You can enable it via 'OPENCV_IO_ENABLE_OPENEXR' option.
```

Currently observable on `tests/test_clip_manager.py::TestVideoMaMa::test_videomama_exr_gamma_handling` when running `pytest` directly (no env var). CI passes because `.github/workflows/ci.yml` sets the env var on the runner.

Fix

One-line change to `pyproject.toml`:

```diff
-dev = ["pytest", "pytest-cov", "ruff", "hypothesis"]
+dev = ["pytest", "pytest-cov", "pytest-env", "ruff", "hypothesis"]
```

After `uv sync --group dev`, pytest picks up the `env` config and OpenEXR works locally without anyone exporting an env var.

Why now

Surfaced while reviewing PR #241 (blue-screen support). Not blocking that PR — happy to send this as a tiny standalone fix.

Activity

  1. alexandremendoncaalvaro commented on May 1, 2026

    @alexandremendoncaalvaro
    ContributorAuthor

    Superseded by #247.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions