question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot run doctests on a single rst file with --test-path option

See original GitHub issue

I used to be able to run the doctests in a single rst file using the test runner -t (--test-path) option, e.g.:

python setup.py test -t docs/overview.rst

Unexpectedly, this command now runs all of the doctests. The -t option still works as expected for a single python module.

Also, the -t option states that it “May also be an absolute path”. When I used an absolute path to an rst file, I got “ERROR: not found (no name ‘<fullpath>’ in any of [])”. When I used an absolute path to a py file, I got two KeyErrors from pytest.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:10 (10 by maintainers)

github_iconTop GitHub Comments

5reactions
drdavellacommented, Nov 1, 2018

To make sure @larrybradley retains primacy in this vital matter, I need to admit that he told me about it last week and I forgot to pursue it then. Sorry to steal your hipster cred, @eteq.

2reactions
bsipoczcommented, Oct 30, 2018

Chances are 100% if you open a PR and tests pass.

and the tests for downstream packages using the astropy test runner 😉

Read more comments on GitHub >

github_iconTop Results From Across the Web

doctest running in sphinx doc - Stack Overflow
I should just run the following command: $ pytest 'path to static rst files' --doctest-glob=*.rst --doctest-module.
Read more >
Issue 15629: Add to regrtest the ability to run Lib and Doc doctests ...
One option for whitelisting files would be to subclass doctest.DocTestParser and pass an instance as the parser argument to doctest.DocFileSuite: http://docs.
Read more >
pytest Documentation - Read the Docs
pytest will run all files of the form test_*.py or *_test.py in the ... so it doesn't matter which one runs first because...
Read more >
run doctests with nose - Read the Docs
When loading doctests from non-module files, use the --doctest-fixtures switch to specify how to find modules containing fixtures for the tests. A module...
Read more >
Source code for astropy.tests.runner
Don't import pytest until it's actually needed to run the tests import pytest ... "Test path must be a directory or a path...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found