Skip to content

Added plugin to filter by sub-packages#19

Closed
astrofrog wants to merge 1 commit intoastropy:masterfrom
astrofrog:pytest-subpackage
Closed

Added plugin to filter by sub-packages#19
astrofrog wants to merge 1 commit intoastropy:masterfrom
astrofrog:pytest-subpackage

Conversation

@astrofrog
Copy link
Member

This is a small plugin that was inspired by discussions in astropy/astropy-APEs#52 - basically this adds the ability to do e.g.

pytest -P io.fits,constants

However, this only works for now if I remove:

doctest_plus = enabled

from setup.cfg, so I need to spend more time to understand how to get the plugins to work nicely.

Note that this also makes pytest-astropy into a real package rather than just a meta-package. I think this plugin is too astropy-specific to put in a standalone plugin.

@pllim
Copy link
Member

pllim commented Jun 27, 2019

Is this really necessary? pytest can already support collecting only tests from given directories, and our subpackages are organized in directories. Wouldn't something like this already be sufficient?

pytest astropy/io/fits/ astropy/io/misc/

@astrofrog
Copy link
Member Author

astrofrog commented Jun 27, 2019

@pllim - I got asked several times in astropy/astropy-APEs#52 for this functionality, so just thought I'd give it a shot - @bsipocz and others listed it as a critical feature of python setup.py test that they can't do without :)

Note that this isn't just equivalent to:

pytest astropy/io/fits/ astropy/io/misc/

it's equivalent to:

pytest astropy/io/fits/ astropy/io/misc/ docs/io/fits docs/io/misc

so it does save a bit of typing.

I never plan on using this though, I'm fine with just calling pytest with the explicit paths.

@pllim
Copy link
Member

pllim commented Jun 27, 2019

calling pytest with the explicit paths

Explicit is better than implicit, right? Maybe they just have to deal with a bit more typing and less maintenance for us.

@bsipocz
Copy link
Member

bsipocz commented Jun 27, 2019

I have strong feeling about it that we need this, otherwise many would end up not testing the docs. And it's convenient, too. And honestly we maintain less useful stuff all over the place.

@pllim
Copy link
Member

pllim commented Dec 12, 2019

There's a conflict.

@astrofrog
Copy link
Member Author

I split this out into a separate plugin package: https://github.com/astropy/pytest-filter-subpackage - so I'll close this for now, and once that plugin is released we can add it as a dependency for pytest-astropy.

@astrofrog astrofrog closed this Dec 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants