Changeset 65

Show
Ignore:
Timestamp:
Thu Jun 22 21:07:16 2006
Author:
jpellerin
Message:

r2489@Jason-Pellerins-Computer: jhp | 2006-06-22 21:06:25 -0500
Add test cases for missed test plugin, loader to improve test coverage

Files:

Legend:

Unmodified
Added
Removed
Modified
  • branches/0.9-stable/unit_tests/test_loader.py

    r40 r65  
    72 72         self.assertEqual(found, expect)  
    73 73  
    74    
    75 74     def test_load_from_names_compat(self):  
    76 75         c = Config()  
  • branches/0.9-stable/unit_tests/test_plugins.py

    r53 r65  
    331 331  
    332 332     def test_options(self):  
    333           pass  
      333         opt = Config()  
      334         parser = OptionParser()  
      335         plug = MissedTests()  
      336         plug.add_options(parser, {})  
      337         opts = [ o._long_opts[0] for o in parser.option_list ]  
      338         assert '--with-missed-tests' in opts  
    334 339  
    335 340     def test_match(self):  
     
    371 376         assert not plug.match(foo, __name__ + '.whatever')  
    372 377         assert not plug.match(foo, '/some/path')  
      378  
      379     def test_begin(self):         
      380         plug = MissedTests()  
      381         plug.conf = Config()  
      382         plug.begin()  
      383         assert plug.missed is None  
      384  
      385         plug.conf.tests = ['a']  
      386         plug.begin()  
      387         self.assertEqual(plug.missed, ['a'])  
      388         assert plug.missed is not plug.conf.tests  
      389  
      390     def test_finalize(self):  
      391         plug = MissedTests()  
      392         plug.missed = ['a']  
      393  
      394         out = []  
      395         class dummy:  
      396             pass  
      397  
      398         result = dummy()  
      399         result.stream = dummy()  
      400         result.stream.writeln = out.append  
      401          
      402         plug.finalize(result)  
      403         self.assertEqual(out, ["WARNING: missed test 'a'"])  
    373 404          
    374 405 if __name__ == '__main__':  
  • branches/0.9-stable/nose/loader.py

    r40 r65  
    309 309     # FIXME this needs to be moved and generalized for methods?  
    310 310     def generateTests(self, test):  
      311         """Generate tests from a test function that is a generator.  
      312         Returns list of test functions.  
      313         """  
    311 314         cases = []  
    312 315         for expr in test():  
     
    338 341  
    339 342 def method_test_case(cls):  
      343     """Return a method test case factory bound to cls.  
      344     """  
    340 345     def make_test_case(test_name):  
    341 346         """Method test case factory. May return a method test case, or a