(loader, tests, pattern)
| 5119 | |
| 5120 | |
| 5121 | def load_tests(loader, tests, pattern): |
| 5122 | tests = (CIOTest, PyIOTest, APIMismatchTest, |
| 5123 | CBufferedReaderTest, PyBufferedReaderTest, |
| 5124 | CBufferedWriterTest, PyBufferedWriterTest, |
| 5125 | CBufferedRWPairTest, PyBufferedRWPairTest, |
| 5126 | CBufferedRandomTest, PyBufferedRandomTest, |
| 5127 | StatefulIncrementalDecoderTest, |
| 5128 | CIncrementalNewlineDecoderTest, PyIncrementalNewlineDecoderTest, |
| 5129 | CTextIOWrapperTest, PyTextIOWrapperTest, |
| 5130 | CMiscIOTest, PyMiscIOTest, |
| 5131 | CSignalsTest, PySignalsTest, TestIOCTypes, |
| 5132 | ProtocolsTest, |
| 5133 | ) |
| 5134 | |
| 5135 | # Put the namespaces of the IO module we are testing and some useful mock |
| 5136 | # classes in the __dict__ of each test. |
| 5137 | mocks = (MockRawIO, MisbehavedRawIO, MockFileIO, CloseFailureIO, |
| 5138 | MockNonBlockWriterIO, MockUnseekableIO, MockRawIOWithoutRead, |
| 5139 | SlowFlushRawIO, MockCharPseudoDevFileIO) |
| 5140 | all_members = io.__all__ |
| 5141 | c_io_ns = {name : getattr(io, name) for name in all_members} |
| 5142 | py_io_ns = {name : getattr(pyio, name) for name in all_members} |
| 5143 | globs = globals() |
| 5144 | c_io_ns.update((x.__name__, globs["C" + x.__name__]) for x in mocks) |
| 5145 | py_io_ns.update((x.__name__, globs["Py" + x.__name__]) for x in mocks) |
| 5146 | for test in tests: |
| 5147 | if test.__name__.startswith("C"): |
| 5148 | for name, obj in c_io_ns.items(): |
| 5149 | setattr(test, name, obj) |
| 5150 | test.is_C = True |
| 5151 | elif test.__name__.startswith("Py"): |
| 5152 | for name, obj in py_io_ns.items(): |
| 5153 | setattr(test, name, obj) |
| 5154 | test.is_C = False |
| 5155 | |
| 5156 | suite = loader.suiteClass() |
| 5157 | for test in tests: |
| 5158 | suite.addTest(loader.loadTestsFromTestCase(test)) |
| 5159 | return suite |
| 5160 | |
| 5161 | if __name__ == "__main__": |
| 5162 | unittest.main() |
no test coverage detected