pytest-mpl icon indicating copy to clipboard operation
pytest-mpl copied to clipboard

Make options more consistent

Open astrofrog opened this issue 8 years ago • 7 comments

Some options are available only through the decorator (e.g. the style), while some are accessible as command-line options and one (the results dir) is also an ini option. We should make this more consistent so that e.g. styles can be set globally on the command-line or in an ini file.

astrofrog avatar Oct 11 '17 15:10 astrofrog

@dopplershift - could you explain why you added mpl-results-path as an ini option in addition to a command-line option? I started adding other options as ini options but then noticed that most other plugins don't really do this, so I was wondering whether we even need ini options at all?

astrofrog avatar Oct 11 '17 16:10 astrofrog

I like the ini options because it lets me put our standard workflow in setup.cfg, and then running our tests is just pytest or python setup.py test.

dopplershift avatar Oct 16 '17 19:10 dopplershift

You don't need the ini option to use setup.cfg though since you could also add any option to the [pytest] section in setup.cfg anyway?

astrofrog avatar Oct 16 '17 21:10 astrofrog

I have mpl-results-path listed under [tool:pytest] currently. I was under the impression that this didn't work until I added the ini section support for it. Am I mistaken?

dopplershift avatar Oct 16 '17 21:10 dopplershift

@dopplershift - I have to double check, but I know for sure you can do:

[tool:pytest]
addopts = --mpl

without the ini.

astrofrog avatar Oct 16 '17 23:10 astrofrog

I didn't know about addopts. That seems to work fine for my cases, so I'm ok with removing the direct ini options.

dopplershift avatar Oct 17 '17 16:10 dopplershift

Ok, here's one reservation I have after working with addopts. The ini option specific to pytest-mpl is ignored if pytest-mpl isn't installed, whereas the addopts is always on. This produces errors if pytest-mpl isn't installed.

dopplershift avatar Oct 18 '17 21:10 dopplershift