Skip to content

Skip doctest collection for subpackages depending on available dependencies#10358

Merged
pllim merged 4 commits intoastropy:masterfrom
astrofrog:doctest-subpackage-requires
May 20, 2020
Merged

Skip doctest collection for subpackages depending on available dependencies#10358
pllim merged 4 commits intoastropy:masterfrom
astrofrog:doctest-subpackage-requires

Conversation

@astrofrog
Copy link
Member

This is an experiment to try out the proposed fix for scientific-python/pytest-doctestplus#112 which allows doctest collection to be skipped per subpackage based on requirements.

The first commit's CI should fail before I actually define any options in setup.cfg (this is a deliberate test). Once I've checked that it fails, I'll push the fixes.

@astrofrog
Copy link
Member Author

Ok so that fails nicely. Now pushing the skipping configuration!

@astrofrog
Copy link
Member Author

astrofrog commented May 16, 2020

Ok so let's see if that works. Note to self that I should find a way to avoid the following warning during collection though:

collecting ... The 'asdf' distribution was not found and is required by the application
collecting 8561 items / 22 skipped / 8539 selected

Should be an easy fix.

@astrofrog
Copy link
Member Author

It works!

setup.cfg Outdated
doctest_norecursedirs =
*/setup_package.py
doctest_subpackage_requires =
astropy/io/misc/asdf/*=asdf
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spaces around = is even more consistent! 😉

Suggested change
astropy/io/misc/asdf/*=asdf
astropy/io/misc/asdf/* = asdf

Copy link
Member

@pllim pllim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, doesn't appear we have a job that runs without optional dependencies here but that is out of scope (see #10342).

@astrofrog
Copy link
Member Author

Hmm, doesn't appear we have a job that runs without optional dependencies here but that is out of scope (see #10342).

Good point, I'll add a job to the Travis matrix with minimal dependencies, in the initial stage of testing

@astrofrog
Copy link
Member Author

@pllim - to test this more, I've also (for now) reverted some of the changes in #10257 since we can now more easily skip the doctest collection, and I think the current structure is more convoluted with checks and exceptions all the time. I think it's reasonable to expect that importing astropy.io.misc.yaml should fail if PyYAML is not installed.

@astrofrog
Copy link
Member Author

(still experimental btw, do not merge!)

@pllim
Copy link
Member

pllim commented May 20, 2020

Re: yaml -- Yes, sound fine. Thanks for cleaning up my mess!

@astrofrog astrofrog force-pushed the doctest-subpackage-requires branch from bf32ba8 to 8f7aa99 Compare May 20, 2020 15:00
@astrofrog astrofrog requested a review from pllim May 20, 2020 15:03
@astrofrog astrofrog added this to the v4.0.2 milestone May 20, 2020
…skip doctest collection in astropy.io.misc.yaml if PyYAML is not available.
@astrofrog astrofrog force-pushed the doctest-subpackage-requires branch from 8f7aa99 to 7ee1760 Compare May 20, 2020 15:36
@astrofrog astrofrog changed the title EXP: skip doctest collection for subpackages depending on available dependencies Skip doctest collection for subpackages depending on available dependencies May 20, 2020
Copy link
Member

@pllim pllim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks!

@pllim pllim added the zzz 💤 merge-when-ci-passes Do not use: We have auto-merge option now. label May 20, 2020
@pllim pllim merged commit c24e358 into astropy:master May 20, 2020
@mhvk
Copy link
Contributor

mhvk commented May 20, 2020

Belated 👍 to this change - very nice to have the yaml.py file cleaned up (even though it was made messy only out of necessity).

astrofrog pushed a commit that referenced this pull request May 22, 2020
Skip doctest collection for subpackages depending on available dependencies
astrofrog pushed a commit that referenced this pull request May 22, 2020
Skip doctest collection for subpackages depending on available dependencies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants