Trees | Indices | Help |
|
---|
|
1 ################################################################################ 2 # # 3 # Copyright (C) 2011 Edward d'Auvergne # 4 # # 5 # This file is part of the program relax. # 6 # # 7 # relax is free software; you can redistribute it and/or modify # 8 # it under the terms of the GNU General Public License as published by # 9 # the Free Software Foundation; either version 2 of the License, or # 10 # (at your option) any later version. # 11 # # 12 # relax is distributed in the hope that it will be useful, # 13 # but WITHOUT ANY WARRANTY; without even the implied warranty of # 14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 15 # GNU General Public License for more details. # 16 # # 17 # You should have received a copy of the GNU General Public License # 18 # along with relax; if not, write to the Free Software # 19 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # 20 # # 21 ################################################################################ 22 23 # Module docstring. 24 """Replacement unittest.TestLoader class. 25 26 This is to handle skipping of tests when Python modules are not installed. 27 """ 28 29 # Python module imports 30 from unittest import TestLoader, TestSuite 31 32 # relax module imports. 33 from status import Status; status = Status() 34 3537 """Replacement TestLoader class.""" 386840 """Replacement method for skipping tests.""" 41 42 # A check from the original function. 43 if issubclass(testCaseClass, TestSuite): 44 raise TypeError("Test cases should not be derived from TestSuite. Maybe you meant to derive from TestCase?") 45 46 # Get the test names. 47 testCaseNames = self.getTestCaseNames(testCaseClass) 48 49 # Again from the original function. 50 if not testCaseNames and hasattr(testCaseClass, 'runTest'): 51 testCaseNames = ['runTest'] 52 53 # Generate a list of test cases. 54 case_list = [] 55 for i in range(len(testCaseNames)): 56 # Initialise the test case. 57 test_case = testCaseClass(testCaseNames[i]) 58 59 # Skip. 60 if status.skipped_tests and testCaseNames[i] in zip(*status.skipped_tests)[0]: 61 continue 62 63 # Append the test case. 64 case_list.append(test_case) 65 66 # Return the test suite. 67 return self.suiteClass(case_list)
Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Wed Apr 10 14:16:55 2013 | http://epydoc.sourceforge.net |