[py-dev] Instantiating Test* classes

Ian Bicking ianb at colorstudy.com
Tue May 10 19:09:21 CEST 2005


Ian Bicking wrote:
> That makes sense, but it confuses me that all the tests used to work.  I 
> guess before the collect branch was remerged.  I think I'll look into a 
> conftest.py file that specifically avoids anything that subclasses 
> SQLObject; I have to figure out that stuff anyway.

Here's what I added to sqlobject.conftest that seems to work:

class SQLObjectClass(py.test.collect.Class):
     def run(self):
         if (isinstance(self.obj, type)
             and issubclass(self.obj, sqlobject.SQLObject)):
             return []
         return super(SQLObjectClass, self).run()

# I assume this name magically overrides the normal class collector:
Class = SQLObjectClass

I also clearly have to figure out py.documentation.conftest, as that 
seems to have doctest and ReST hooks that I'll want to use.

-- 
Ian Bicking  /  ianb at colorstudy.com  /  http://blog.ianbicking.org



More information about the Pytest-dev mailing list