Changeset 2915 for trunk/tests

Show
Ignore:
Timestamp:
03/15/07 11:32:43 (2 years ago)
Author:
paul
Message:

Made the importing of coverage optional for masterTestSuite.

Nate, where do I find:

coverage
mock

I do have a pmock package, that has a Mock(). Would that work?

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/tests/unitTests/masterTestSuite.py

    r2898 r2915  
    1 """Master test control for the test suite.  Tests for all Tiers plus the lib section of Dabo are imported and run from here. 
     1"""Master test control for the test suite.   
    22 
    3 This will import the DB, Biz, Lib, and UI Tiers for the test.  We will add the test files manually in the __init__.py files 
    4 in each module.  The init files and every Test Case file must provide a function suite() which will return a unittest.TestSuite 
    5 object that encompasses the all of the test cases and suite within that file or module.  See the sample init and testCase files 
    6 for more information. 
     3This will import the DB, Biz, Lib, and UI Tiers for the test.  We will add  
     4the test files manually in the __init__.py files in each module.  The init  
     5files and every Test Case file must provide a function suite() which will  
     6return a unittest.TestSuite object that encompasses the all of the test  
     7cases and suite within that file or module.  See the sample init and  
     8testCase files for more information. 
    79""" 
    810 
    911import unittest 
    10 import coverage 
     12try: 
     13    import coverage 
     14except ImportError: 
     15    coverage = None 
    1116import sys 
    1217 
    13 coverage.erase() 
    14 coverage.start() 
     18if coverage: 
     19    coverage.erase() 
     20    coverage.start() 
    1521 
    16 coverage.exclude('if __name__ == "__main__":') 
     22   coverage.exclude('if __name__ == "__main__":') 
    1723 
    1824import dabo 
     
    3642unittest.TextTestRunner(verbosity=2).run(allTiersTestSuite) 
    3743 
    38 coverage.stop() 
    39 #You can uncomment this to get test coverage on a particular module, but if you want to 
    40 #see the entire report for dabo, run "python CoverageReport.py".  I would pipe it to a file though 
    41 #coverage.report([dabo.dColors, dabo.dObject, dabo]) 
     44if coverage: 
     45    coverage.stop() 
     46    #You can uncomment this to get test coverage on a particular module, but if you want to 
     47    #see the entire report for dabo, run "python CoverageReport.py".  I would pipe it to a file though 
     48    #coverage.report([dabo.dColors, dabo.dObject, dabo])