Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Make pytest run the doctests in doc rst files #9445

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
amueller opened this issue Jul 24, 2017 · 10 comments · Fixed by #9697
Closed

Make pytest run the doctests in doc rst files #9445

amueller opened this issue Jul 24, 2017 · 10 comments · Fixed by #9697

Comments

@amueller
Copy link
Member

It looks like the pytest run on travis doesn't run the doctests:
https://travis-ci.org/scikit-learn/scikit-learn/builds/256859150?utm_source=github_status&utm_medium=notification

We should fix that.

@jnothman
Copy link
Member

jnothman commented Jul 24, 2017 via email

@lesteve
Copy link
Member

lesteve commented Jul 26, 2017

This was noted in one of the pytest issue/PR and it something that is on my radar once we released 0.19 and move fully to pytest.

@lesteve
Copy link
Member

lesteve commented Jul 26, 2017

This was noted in one of the pytest issue/PR and it something that is on my radar once we released 0.19 and move fully to pytest.

e.g. in #8246 (comment).

@lesteve
Copy link
Member

lesteve commented Jul 26, 2017

Setup.cfg does specify --doctest-modules, and test_script.sh appears to install it... Not sure what's going on here.

I think this issue is about the doctests in the doc .rst not the doctests in the python modules.

@lesteve lesteve changed the title Make pytest run the doctests Make pytest run the doctests in doc rst files Jul 26, 2017
@amueller
Copy link
Member Author

@lesteve good radar :)
I think it's good to open issues for such problems, though, so
a) Other people can work on them
b) people that have no time to keep up (like myself) can find out about them ;)

@amueller
Copy link
Member Author

I'm not sure I understand your comment. It seems to work fine for me locally, using pytest --doctest-glob='*.rst'

@amueller
Copy link
Member Author

Interestingly it works if I run it in the modules subfolder, but running it in the doc folder doesn't work?

@amueller
Copy link
Member Author

Interestingly

> pytest --doctest-glob='*.rst'   doc/tutorial/text_analytics

results in multiple ImportMismatchErrors for me locally...

@lesteve
Copy link
Member

lesteve commented Aug 1, 2017

Off the top of my head one thing I remember last time I looked is that there is no straight equivalent of nosetests --doctest-fixtures.

I did not look at it in more details since.

@amueller
Copy link
Member Author

amueller commented Aug 1, 2017

you have to call getfixture for making a fixture work with doctests.

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

Successfully merging a pull request may close this issue.

3 participants