nose-devs/nose — Issue #103: Problem with resolving instance methods by name
Author: jpellerin
Created: 2011-12-14 15:59:19+00:00
State: open

tested with nose version: 0.11.1

Resolving test method by names fails in some cicumstances.

Attached file shows a problem with more complex test generation routines.
We have an ordinary test method do_test on class test_class.
We need this method to be tested several times in different conditions,
here represented by different values of self.conf.
We created a using() decorator which replaces test method with a test
generator
which yields methods setting proper conditions and executing the test.
Unfortunately nose collects test methods using their name rather than them
themselves. This breaks our tests, because yielded method has the same name
as the generator method.

Attached patch seems like a better way to get a method bound to an
instance, it doesn't rely on method name consistence.
Method's function is available only in im_func in python < 2.6 and only in
__func__ in python >= 3.0, hence the double getattrs.

Google Code Info:
Issue #: 303
Author: filip.zy...@gmail.com
Created On: 2009-11-05T12:57:27.000Z
Closed On: