nose-devs / nose

nose is nicer testing for python
http://readthedocs.org/docs/nose/en/latest/
1.36k stars 394 forks source link

Conflicts with unittest #555

Open pkch opened 11 years ago

pkch commented 11 years ago

I posted this question at SO, but I figured maybe it belongs here. Essentially, I'm trying to use nose as an extension for unittest, and find that one of its best features is implemented not as an extension but as a replacement: test generators cannot be used with unittest.TestCase subclasses. As such, I can't use unittest's features (e.g., its asserts, etc.) if I want to use test generators.

Is there a plan to allow this in the future?

Are there any other conflicts with unittest (besides the obvious: unittest won't, of course, recognize module level functions)?

jpellerin commented 11 years ago

In nose, the lack of support for funkier kinds of tests in unittest.TestCases is intentional -- the idea is that nose should collect test from unittest.TestCases exactly as unittest does. Probably that was a bad idea, but undoing it would take far more time than I have available.

As long as you don't mind being a bit out on the bleeding edge, I'd suggest trying nose2 if you want to use generators or parameterized tests with unittest.TestCases -- nose2 doesn't discriminate and supports all kinds of test plugins for all kinds of tests. Docs are on rtd: http://nose2.readthedocs.org/en/latest/index.html

JP

On Sun, Sep 16, 2012 at 8:56 AM, mmoroz notifications@github.com wrote:

I posted this questionhttp://stackoverflow.com/questions/12376598/conflicts-between-unittest-and-nose-frameworksat SO, but I figured maybe it belongs here. Essentially, I'm trying to use nose as an extension for unittest, and find that one of its best features is implemented not as an extension but as a replacement: test generators cannot be used with unittest.TestCase subclasses. As such, I can't use unittest's features (e.g., its asserts, etc.) if I want to use test generators.

Is there a plan to allow this in the future?

Are there any other conflicts with unittest (besides the obvious: unittest won't, of course, recognize module level functions)?

— Reply to this email directly or view it on GitHubhttps://github.com/nose-devs/nose/issues/555.