matplotlib/pytest-mpl

Enable image comparison by default

bersbersbers opened this issue · 1 comments

I am used to typing pytest, so I often forget --mpl. Similarly, VS Code's testing pane does not add --mpl and makes test pass falsely.

I have been looking for a way to enable image comparison by default, yet without success.

  • I have read https://pytest-mpl.readthedocs.io/en/stable/configuration.html#enable-testing, which has nothing.
  • I have tried adding pytest_plugins = ("pytest_mpl.plugin",) to conftest.py, but I am getting ValueError: Plugin already registered under a different name: pytest_mpl.plugin=<module 'pytest_mpl.plugin' from 'C:\\ws\\project\\.venv\\Lib\\site-packages\\pytest_mpl\\plugin.py'>
  • I have looked into how pytest parses command-line arguments, but I haven't found a way to inject anything there.
  • I have tried adding import sys; sys.argv = [*sys.argv, "--mpl"] to conftest.py.

How can I force --mpl? (Why does it have to be passed anyway?)