pombreda / python-nose

Automatically exported from code.google.com/p/python-nose
0 stars 0 forks source link

attrib plugin has problems with classes containing static methods #411

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
If the following test case is saved as "mytest.py", then 'nosetests -a myattr 
mytest.py' fails because the attrib plugin tries to evaluate "method.im_class" 
on the staticmethod and blows up since staticmethods don't have an im_class 
property:

import unittest
from nose.plugins.attrib import attr

class TestWithStatic(unittest.TestCase):
    @staticmethod
    def hello(): pass

    @attr('myattr')
    def test_with_static(self): pass

Original issue reported on code.google.com by bob...@gmail.com on 16 Apr 2011 at 2:20

GoogleCodeExporter commented 9 years ago
patch is in https://code.google.com/r/bobbyi-attributes/source/list

Original comment by kumar.mcmillan on 2 May 2011 at 8:16

GoogleCodeExporter commented 9 years ago
This will be released in 1.0.1

Original comment by kumar.mcmillan on 2 May 2011 at 8:35

GoogleCodeExporter commented 9 years ago
Work-around: change the staticmethod to a classmethod, and ignore the extra 
class parameter.

Original comment by d...@energysavvy.com on 22 Jul 2011 at 12:46