Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

nose unittest discovery broken on python 3.8

Upgraded from python 3.7 to 3.8 today. Unittest discovery in nose no longer works.

Simplified project layout

x:\proj\src\__init__.py
x:\proj\src\first.py
x:\proj\tests\__init.py
x:\proj\tests\testfirst.py

From project root x:\proj, run:

nosetests -v
-----------------------------------------------
Ran 0 tests in 0.016s

OK

Can only run unittests by specifying them, eg:

nosetests tests.testfirst
.
----------------------------------------------------------------------
Ran 1 test in 0.000s

OK

Platform

  • nosetests version 1.3.7
  • Python 3.8.0 (tags/v3.8.0:fa919fd, Oct 14 2019, 19:37:50) [MSC v.1916 64 bit (AMD64)] on win32
like image 877
user590028 Avatar asked Oct 25 '19 09:10

user590028


1 Answers

Nose now requires you use the --traverse-namespace option when there are multiple packages. You can add this to the nosetests invocation, or to save yourself typing, add it to setup.cfg, eg:

[nosetests]
traverse-namespace=1
like image 134
user590028 Avatar answered Sep 24 '22 14:09

user590028