Is it possible to run doctrines with unit2

I recently switched from nose to the new unittest2 package for my python module testing needs. It does everything I want, except for the fact that I cannot get the โ€œdiscoverโ€ command to recognize the doctrines in my code - I still need to use my nose to run them. Is this not implemented or is there something I don't see here?

+3
source share
2 answers

Unit2 only detects regular Python tests. In order to run your doctrines, I'm afraid you will need to write a minimal template. In addition: the upcoming plug-in architecture will simplify the automation of some of these tasks.

. ( unittest2) http://www.voidspace.org.uk/python/weblog/arch_d7_2010_07_10.shtml

+3

, , unit2 , , , :

http://docs.python.org/library/doctest.html#unittest-api

, DocTestSuite , , ; :

from doctest import DocTestSuite
from unittest import TestSuite

def load_tests(loader, tests, pattern):
    suite = TestSuite()
    suite.addTests(DocTestSuite('my.module.one'))
    suite.addTests(DocTestSuite('my.module.two'))
    suite.addTests(DocTestSuite('my.module.three'))
    return suite
+1

Source: https://habr.com/ru/post/1756713/


All Articles