python - Force nosetests to find doctests in modules starting with underscore -


basically in project use following pattern:

package:   __init__.py   _mod1.py      _mod2.py 

these modules considered implementation detail , don't want users import them. use doctests test internal modules. in default configuration nosetests won't find doctests in these modules.

i tried fix using match option (and doctest modules matched), dummy matches python stdlib.

details of system:

  • python 3.3
  • python compiled pythonz
  • i use virtualenv , virtualenvwrapper
  • nosetests installed inside virtualenv
  • i use nose 1.3.0

here nose config file:

[nosetests] match=[^.][tt]est with-doctest=1 processes=50 process-timeout=25 verbosity=3 attr=!singleprocess ignore-files=.*pythonz.* 

examples of bogus matches:

====================================================================== error: skip test. ---------------------------------------------------------------------- traceback (most recent call last):   file "/home/jb/.pythonz/pythons/cpython-3.3.2/lib/python3.3/unittest/case.py", line 384, in _executetestpart     function() typeerror: skiptest() missing 1 required positional argument: 'reason'  ====================================================================== error: skip test. ---------------------------------------------------------------------- traceback (most recent call last):   file "/home/jb/.pythonz/pythons/cpython-3.3.2/lib/python3.3/unittest/case.py", line 384, in _executetestpart     function() typeerror: skiptest() missing 1 required positional argument: 'reason'  ====================================================================== error: decorator mark function or method test ---------------------------------------------------------------------- traceback (most recent call last):   file "/home/jb/.virtualenvs/silf-backend-commons/lib/python3.3/site-packages/nose/case.py", line 198, in runtest     self.test(*self.arg)   file "/home/jb/.virtualenvs/silf-backend-commons/lib/python3.3/site-packages/nose/util.py", line 613, in newfunc     return func(*arg, **kw) typeerror: istest() missing 1 required positional argument: 'func'  ====================================================================== error: decorator mark function or method *not* test ---------------------------------------------------------------------- traceback (most recent call last):   file "/home/jb/.virtualenvs/silf-backend-commons/lib/python3.3/site-packages/nose/case.py", line 198, in runtest     self.test(*self.arg)   file "/home/jb/.virtualenvs/silf-backend-commons/lib/python3.3/site-packages/nose/util.py", line 613, in newfunc     return func(*arg, **kw) typeerror: nottest() missing 1 required positional argument: 'func'  ====================================================================== error: skip test. ---------------------------------------------------------------------- traceback (most recent call last):   file "/home/jb/.pythonz/pythons/cpython-3.3.2/lib/python3.3/unittest/case.py", line 384, in _executetestpart     function() typeerror: skiptest() missing 1 required positional argument: 'reason'  ====================================================================== error: decorator mark function or method test ---------------------------------------------------------------------- traceback (most recent call last):   file "/home/jb/.virtualenvs/silf-backend-commons/lib/python3.3/site-packages/nose/case.py", line 198, in runtest     self.test(*self.arg)   file "/home/jb/.virtualenvs/silf-backend-commons/lib/python3.3/site-packages/nose/util.py", line 613, in newfunc     return func(*arg, **kw) typeerror: istest() missing 1 required positional argument: 'func'  ====================================================================== error: skip test. ---------------------------------------------------------------------- traceback (most recent call last):   file "/home/jb/.pythonz/pythons/cpython-3.3.2/lib/python3.3/unittest/case.py", line 384, in _executetestpart     function() typeerror: skiptest() missing 1 required positional argument: 'reason'  ====================================================================== error: decorator mark function or method test ---------------------------------------------------------------------- traceback (most recent call last):   file "/home/jb/.virtualenvs/silf-backend-commons/lib/python3.3/site-packages/nose/case.py", line 198, in runtest     self.test(*self.arg)   file "/home/jb/.virtualenvs/silf-backend-commons/lib/python3.3/site-packages/nose/util.py", line 613, in newfunc     return func(*arg, **kw) typeerror: istest() missing 1 required positional argument: 'func'  ====================================================================== error: skip test. ---------------------------------------------------------------------- traceback (most recent call last):   file "/home/jb/.pythonz/pythons/cpython-3.3.2/lib/python3.3/unittest/case.py", line 384, in _executetestpart     function() typeerror: skiptest() missing 1 required positional argument: 'reason'  ====================================================================== error: skip test. ---------------------------------------------------------------------- traceback (most recent call last):   file "/home/jb/.pythonz/pythons/cpython-3.3.2/lib/python3.3/unittest/case.py", line 384, in _executetestpart     function() typeerror: skiptest() missing 1 required positional argument: 'reason'  ====================================================================== error: skip test. ---------------------------------------------------------------------- traceback (most recent call last):   file "/home/jb/.pythonz/pythons/cpython-3.3.2/lib/python3.3/unittest/case.py", line 384, in _executetestpart     function() typeerror: skiptest() missing 1 required positional argument: 'reason'  ====================================================================== error: skip test. ---------------------------------------------------------------------- traceback (most recent call last):   file "/home/jb/.pythonz/pythons/cpython-3.3.2/lib/python3.3/unittest/case.py", line 384, in _executetestpart     function() typeerror: skiptest() missing 1 required positional argument: 'reason'  ====================================================================== error: skip test. ---------------------------------------------------------------------- traceback (most recent call last):   file "/home/jb/.pythonz/pythons/cpython-3.3.2/lib/python3.3/unittest/case.py", line 384, in _executetestpart     function() typeerror: skiptest() missing 1 required positional argument: 'reason'  ====================================================================== error: decorator mark function or method test ---------------------------------------------------------------------- traceback (most recent call last):   file "/home/jb/.virtualenvs/silf-backend-commons/lib/python3.3/site-packages/nose/case.py", line 198, in runtest     self.test(*self.arg)   file "/home/jb/.virtualenvs/silf-backend-commons/lib/python3.3/site-packages/nose/util.py", line 613, in newfunc     return func(*arg, **kw) typeerror: istest() missing 1 required positional argument: 'func'  ====================================================================== error: skip test. ---------------------------------------------------------------------- traceback (most recent call last):   file "/home/jb/.pythonz/pythons/cpython-3.3.2/lib/python3.3/unittest/case.py", line 384, in _executetestpart     function() typeerror: skiptest() missing 1 required positional argument: 'reason'  ====================================================================== error: skip test. ---------------------------------------------------------------------- traceback (most recent call last):   file "/home/jb/.pythonz/pythons/cpython-3.3.2/lib/python3.3/unittest/case.py", line 384, in _executetestpart     function() typeerror: skiptest() missing 1 required positional argument: 'reason'  ====================================================================== error: skip test. ---------------------------------------------------------------------- nose.proxy.typeerror: skiptest() missing 1 required positional argument: 'reason' -------------------- >> begin captured logging << -------------------- root: debug: firing event <eventobject power_up, (*('default',), **{})> root: debug: firing event <eventobject tick, (*(), **{})> --------------------- >> end captured logging << ---------------------  ====================================================================== error: skip test. ---------------------------------------------------------------------- traceback (most recent call last):   file "/home/jb/.pythonz/pythons/cpython-3.3.2/lib/python3.3/unittest/case.py", line 384, in _executetestpart     function() typeerror: skiptest() missing 1 required positional argument: 'reason'  ====================================================================== error: skip test. ---------------------------------------------------------------------- traceback (most recent call last):   file "/home/jb/.pythonz/pythons/cpython-3.3.2/lib/python3.3/unittest/case.py", line 384, in _executetestpart     function() typeerror: skiptest() missing 1 required positional argument: 'reason'  ====================================================================== error: skip test. ---------------------------------------------------------------------- traceback (most recent call last):   file "/home/jb/.pythonz/pythons/cpython-3.3.2/lib/python3.3/unittest/case.py", line 384, in _executetestpart     function() typeerror: skiptest() missing 1 required positional argument: 'reason'  ====================================================================== error: skip test. ---------------------------------------------------------------------- traceback (most recent call last):   file "/home/jb/.pythonz/pythons/cpython-3.3.2/lib/python3.3/unittest/case.py", line 384, in _executetestpart     function() typeerror: skiptest() missing 1 required positional argument: 'reason'  ====================================================================== error: skip test. ---------------------------------------------------------------------- traceback (most recent call last):   file "/home/jb/.pythonz/pythons/cpython-3.3.2/lib/python3.3/unittest/case.py", line 384, in _executetestpart     function() typeerror: skiptest() missing 1 required positional argument: 'reason'  ====================================================================== error: skip test. ---------------------------------------------------------------------- nose.proxy.typeerror: skiptest() missing 1 required positional argument: 'reason' -------------------- >> begin captured logging << -------------------- test: info: initializing experiment test: info: initialized client test: info: initialized manager test: info: started main thread --------------------- >> end captured logging << ---------------------  ====================================================================== error: skip test. ---------------------------------------------------------------------- traceback (most recent call last):   file "/home/jb/.pythonz/pythons/cpython-3.3.2/lib/python3.3/unittest/case.py", line 384, in _executetestpart     function() typeerror: skiptest() missing 1 required positional argument: 'reason'  ====================================================================== error: skip test. ---------------------------------------------------------------------- traceback (most recent call last):   file "/home/jb/.pythonz/pythons/cpython-3.3.2/lib/python3.3/unittest/case.py", line 384, in _executetestpart     function() typeerror: skiptest() missing 1 required positional argument: 'reason'  ====================================================================== error: skip test. ---------------------------------------------------------------------- traceback (most recent call last):   file "/home/jb/.pythonz/pythons/cpython-3.3.2/lib/python3.3/unittest/case.py", line 384, in _executetestpart     function() typeerror: skiptest() missing 1 required positional argument: 'reason'  ====================================================================== error: skip test. ---------------------------------------------------------------------- traceback (most recent call last):   file "/home/jb/.pythonz/pythons/cpython-3.3.2/lib/python3.3/unittest/case.py", line 384, in _executetestpart     function() typeerror: skiptest() missing 1 required positional argument: 'reason'  ---------------------------------------------------------------------- 

if want prevent import, name doctests module.doctest (for instance), , use --doctest-extension=doctest. approach best practice.

if are required begin module names underscores, you'll need replace nose's default ignore rule, excludes files named in way named them. instance, doctests discovered if add following config:

ignore-files=dontignoreanyfiles 

Comments

Popular posts from this blog

curl - PHP fsockopen help required -

HTTP/1.0 407 Proxy Authentication Required PHP -

c# - Resource not found error -