Conflicts between Unitat and Nose

Nose supports test generators . But the documentation says:

Note that method generators are not supported in unittest.TestCase subclasses.

This means that all of my test generators should be outside the scope of unittest .

Question: Should I use the unittest framework for those tests where I can? Or should I, for reasons of consistency, completely abandon unittest ?

And why does nose not support test generators inside unittest.TestCase ? It seems to unittest the biggest advantage of nose : it is an extension, not a replacement for unittest , thereby offering additional benefits without interrupting any of the functions provided by unittest . Or am I missing something?

And a related question. If I complete unittest completely, should I put my tests in global functions or in a new class hierarchy?

+6
source share
1 answer

The nose lacks support for the coolest types of tests in unittest.TestCases intentionally - the idea was that the nose should collect the test from unittest.TestCases just like unittest. It was probably a bad idea, but now it is unlikely to change.

So, while you do not mind, to get away from the bleeding a little, I would suggest trying a nose2. nose2 does not distinguish and supports all kinds of test plugins for all kinds of tests. The documents are located at rtd: http://nose2.readthedocs.org/en/latest/index.html , downloads at pypi: http://pypi.python.org/pypi/nose2/0.4.1 .

+5
source

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


All Articles