Esempio n. 1
0
    def test_isTestCaseDisabled(self):
        """
        TestCases disabled by nose generators don't get loaded
        """
        class HasDisabled(unittest.TestCase):
            def test_method(self):
                pass

            test_method.__test__ = False

        suite = loader.loadFromTestCase(HasDisabled)
        self.assertEqual(suite.countTestCases(), 0)
Esempio n. 2
0
 def test_normal(self):
     """
     Normal test methods get loaded
     """
     class Normal(unittest.TestCase):
         def test_method1(self):
             pass
         def test_method2(self):
             pass
     suite = loader.loadFromTestCase(Normal)
     self.assertEqual(suite.countTestCases(), 2)
     self.assertEqual(set([x._testMethodName for x in suite._tests]),
                      set(['test_method1', 'test_method2']))
Esempio n. 3
0
 def test_runTest(self):
     """
     When a testcase has no matching method names, but does have a runTest,
     use that instead.
     """
     class MyTestCase(unittest.TestCase):
         def helper1(self):
             pass
         def helper2(self):
             pass
         def runTest(self):
             pass
     suite = loader.loadFromTestCase(MyTestCase)
     self.assertEqual(suite.countTestCases(), 1)
     self.assertEqual(suite._tests[0]._testMethodName, 'runTest')