I have a project with a structure like this:
my_project_with_tests/ project/ __init__.py module.py test/ test.py
module.py contains two doctest 'ed functions:
def foo(): """ >>> foo() 1 """ return 1 def test_foo_doctest(): """ >>> module.foo() 1 """ pass def bar(): """ >>> bar() """ return 1
test.py contains the necessary bits to run the tests:
import sys import os.path sys.path = [os.path.abspath("../project")] + sys.path import module def test_foo(): assert module.foo() == 1 def test_bar(): assert module.bar() == 1
I am currently running my tests using nose with
nosetests \ --all-modules \ --traverse-namespace \ --with-coverage \ --cover-tests \ --with-doctest \ --where test/
However, it does not run doctests from my project sources directory (but the doctests from the test directory are fine, as test_foo_doctest passes).
- Is this a good way to trigger a
nose ? - How to run
doctests from the project directory- using
nose - without changing the directory structure
- without running tests in the
project directory
source share