Changeset 77

Show
Ignore:
Timestamp:
Wed Jul 12 20:42:33 2006
Author:
jpellerin
Message:

r3501@Jason-Pellerins-Computer: jhp | 2006-07-12 20:42:28 -0500
For #60: add nose.runmodule(), which runs tests in a single module only, defaulting to main as the module to run.

Files:

Legend:

Unmodified
Added
Removed
Modified
  • trunk/nose/core.py

    r76 r77  
    15 15 from nose.proxy import ResultProxySuite  
    16 16 from nose.result import Result  
    17   from nose.suite import LazySuite  
      17 from nose.suite import LazySuite, TestModule  
    17 17 from nose.util import absdir, tolist  
    18 18 from nose.importer import add_path  
     
    457 457     end_capture()  
    458 458     return result  
    459                
      459  
      460 def runmodule(name='__main__'):  
      461     """Collect and run tests in a single module only. Defaults to running  
      462     tests in __main__.  
      463     """  
      464     conf = configure()  
      465     testLoader = defaultTestLoader(conf)  
      466     def collector(conf, loader):  
      467         return TestModule(loader.loadTestsFromModule, conf, name)  
      468     main(defaultTest=collector, testLoader=testLoader)     
      469  
    460 470 if __name__ == '__main__':  
    461 471     main()  
  • trunk/nose/__init__.py

    r63 r77  
    291 291 """  
    292 292  
    293   from nose.core import TestCollector, collector, configure, main, run, run_exit  
      293 from nose.core import TestCollector, collector, configure, main, run, \  
      294     run_exit, runmodule  
    294 295 from nose.exc import SkipTest, DeprecatedTest  
    295 296 from nose.loader import TestLoader  
     
    307 308     'SkipTest', 'DeprecatedTest',  
    308 309     'TestCollector', 'TestLoader',  
    309       'collector', 'configure', 'main', 'run', 'run_exit', 'with_setup',  
    310       'file_like', 'split_test_name', 'test_address'  
      310     'collector', 'configure', 'main', 'run', 'run_exit', 'runmodule',  
      311     'with_setup', 'file_like', 'split_test_name', 'test_address'  
    311 312     ]