예제 #1
0
 def testSelectFirstFound(self):
     a, b, c, d = Attrib(), Attrib(), Attrib(), Attrib()
     assertEqual(util._selectAttr("foo", a, b, c, d), None)
     d.foo = "d_foo"
     assertEqual(util._selectAttr("foo", a, b, c, d), "d_foo")
     c.foo = "c_foo"
     assertEqual(util._selectAttr("foo", a, b, c, d), "c_foo")
     b.foo = "b_foo"
     assertEqual(util._selectAttr("foo", a, b, c, d), "b_foo")
     a.foo = "a_foo"
     assertEqual(util._selectAttr("foo", a, b, c, d), "a_foo")
예제 #2
0
    def __init__(self, original):
        super(TestCaseMethodRunner, self).__init__(original)
        self.original = o = original
        self._testCase = o.im_class
        self.methodNames = [o.__name__]
        self.setUpClass = self.testCaseInstance.setUpClass
        self.tearDownClass = self.testCaseInstance.tearDownClass

        for attr in MAGIC_ATTRS:
            objs = [self.original, self._testCase,
                        inspect.getmodule(self._testCase)]
            setattr(self, attr, util._selectAttr(attr, *objs))
예제 #3
0
    def __init__(self, original):
        super(TestCaseRunner, self).__init__(original)
        self.original = original
        self._testCase = self.original

        self.setUpClass = getattr(self.testCaseInstance, 'setUpClass',
                                  _bogusCallable)
        self.tearDownClass = getattr(self.testCaseInstance, 'tearDownClass',
                                     _bogusCallable)

        self.methodNames = [name for name in dir(self.testCaseInstance)
                            if name.startswith(self.methodPrefix)]

        for attr in MAGIC_ATTRS:
            objs = self.original, self.module
            setattr(self, attr, util._selectAttr(attr, *objs))
예제 #4
0
 def suppress(self):
     return util._selectAttr('suppress', self.original, self.parent)
예제 #5
0
 def todo(self):
     return util._selectAttr('todo', self.original, self.parent)