Nose does not launch doctrines from imported modules

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
+4
source share
1 answer
  • This is a good way to name your nose, but there is a small problem that prevents you from running your doctrines. See # 2

  • Change --where test/ to --where . if you run the command from project/project . In this way, the nose will see the teachings. Now he looks only in the test /

+2
source

All Articles