diff -r 37905786b34b -r 1ecba3b8cf88 Lib/test/support/__init__.py --- a/Lib/test/support/__init__.py Sun Apr 12 23:24:17 2015 -0500 +++ b/Lib/test/support/__init__.py Tue Apr 14 12:10:07 2015 -0400 @@ -88,7 +88,7 @@ "skip_unless_symlink", "requires_gzip", "requires_bz2", "requires_lzma", "bigmemtest", "bigaddrspacetest", "cpython_only", "get_attribute", "requires_IEEE_754", "skip_unless_xattr", "requires_zlib", - "anticipate_failure", "load_package_tests", + "anticipate_failure", "load_package_tests", "detect_module_matches", # sys "is_jython", "check_impl_detail", # network @@ -2188,6 +2188,19 @@ return False +def detect_module_mismatch(module1, module2, ignore=None, ignore_private=True): + """ Returns set of items in module1 not in module2, except for a + defined list of items to be ignored in this check. + """ + missing_items = set(dir(module1)) - set(dir(module2)) + if ignore: + missing_items = missing_items - set(ignore) + if ignore_private: + missing_items = [m for m in missing_items + if not (m.startswith('_') or m.endswith('__'))] + return missing_items + + class SuppressCrashReport: """Try to prevent a crash report from popping up. diff -r 37905786b34b -r 1ecba3b8cf88 Lib/test/test_io.py --- a/Lib/test/test_io.py Sun Apr 12 23:24:17 2015 -0500 +++ b/Lib/test/test_io.py Tue Apr 14 12:10:07 2015 -0400 @@ -719,6 +719,20 @@ pass +class CPyMatchTest(unittest.TestCase): + + @unittest.skip('test to be fixed by issue 9858') + def test_RawIOBase_io_in_pyio_match(self): + """ Test that pyio RawIOBase class has all c RawIOBase methods """ + mismatch = support.detect_module_mismatch(pyio.RawIOBase, io.RawIOBase) + self.assertFalse(mismatch) + + def test_RawIOBase_pyio_in_io_match(self): + """ Test that c RawIOBase class has all pyio RawIOBase methods """ + mismatch = support.detect_module_mismatch(io.RawIOBase, pyio.RawIOBase) + self.assertFalse(mismatch) + + class CommonBufferedTests: # Tests common to BufferedReader, BufferedWriter and BufferedRandom @@ -3663,7 +3677,7 @@ def load_tests(*args): - tests = (CIOTest, PyIOTest, + tests = (CIOTest, PyIOTest, CPyMatchTest, CBufferedReaderTest, PyBufferedReaderTest, CBufferedWriterTest, PyBufferedWriterTest, CBufferedRWPairTest, PyBufferedRWPairTest,