Trees | Indices | Help |
|
---|
|
1 ################################################################################ 2 # # 3 # Copyright (C) 2011-2012 Edward d'Auvergne # 4 # # 5 # This file is part of the program relax. # 6 # # 7 # This program 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 3 of the License, or # 10 # (at your option) any later version. # 11 # # 12 # This program 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 # # 20 ################################################################################ 21 22 # Module docstring. 23 """Replacement unittest.TestLoader class. 24 25 This is to handle skipping of tests when Python modules are not installed. 26 """ 27 28 # Python module imports 29 from unittest import TestLoader, TestSuite 30 31 # relax module imports. 32 from status import Status; status = Status() 33 3436 """Replacement TestLoader class.""" 376739 """Replacement method for skipping tests.""" 40 41 # A check from the original function. 42 if issubclass(testCaseClass, TestSuite): 43 raise TypeError("Test cases should not be derived from TestSuite. Maybe you meant to derive from TestCase?") 44 45 # Get the test names. 46 testCaseNames = self.getTestCaseNames(testCaseClass) 47 48 # Again from the original function. 49 if not testCaseNames and hasattr(testCaseClass, 'runTest'): 50 testCaseNames = ['runTest'] 51 52 # Generate a list of test cases. 53 case_list = [] 54 for i in range(len(testCaseNames)): 55 # Initialise the test case. 56 test_case = testCaseClass(testCaseNames[i]) 57 58 # Skip. 59 if status.skipped_tests and testCaseNames[i] in list(zip(*status.skipped_tests))[0]: 60 continue 61 62 # Append the test case. 63 case_list.append(test_case) 64 65 # Return the test suite. 66 return self.suiteClass(case_list)
Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Thu Jul 3 13:38:49 2014 | http://epydoc.sourceforge.net |