Skip to content

Commit 3473d82

Browse files
authored
Replace skips in test_importlib/source/test_file_loader with expectedFailures (RustPython#6194)
* Replace skips with expectedFailure markings for SimpleTest * Uncomment Source-PEP451 tests and apply similar monkey-patches as before * Uncomment Source-PEP302 tests and apply similar monkey-patches as before * Uncomment Sourceless-PEP451 tests and apply similar monkey-patches as before * Uncomment Sourceless-PEP302 tests and apply similar monkey-patches as before
1 parent 3b48dcc commit 3473d82

File tree

1 file changed

+141
-30
lines changed

1 file changed

+141
-30
lines changed

Lib/test/test_importlib/source/test_file_loader.py

Lines changed: 141 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,6 @@ def test_unloadable(self):
236236
warnings.simplefilter('ignore', DeprecationWarning)
237237
loader.load_module('bad name')
238238

239-
@unittest.skip("TODO: RUSTPYTHON; successful only for Frozen")
240239
@util.writes_bytecode_files
241240
def test_checked_hash_based_pyc(self):
242241
with util.create_modules('_temp') as mapping:
@@ -293,7 +292,6 @@ def test_overridden_checked_hash_based_pyc(self):
293292
loader.exec_module(mod)
294293
self.assertEqual(mod.state, 'old')
295294

296-
@unittest.skip("TODO: RUSTPYTHON; successful only for Frozen")
297295
@util.writes_bytecode_files
298296
def test_unchecked_hash_based_pyc(self):
299297
with util.create_modules('_temp') as mapping:
@@ -324,7 +322,6 @@ def test_unchecked_hash_based_pyc(self):
324322
data[8:16],
325323
)
326324

327-
@unittest.skip("TODO: RUSTPYTHON; successful only for Frozen")
328325
@util.writes_bytecode_files
329326
def test_overridden_unchecked_hash_based_pyc(self):
330327
with util.create_modules('_temp') as mapping, \
@@ -362,6 +359,23 @@ def test_overridden_unchecked_hash_based_pyc(self):
362359
) = util.test_both(SimpleTest, importlib=importlib, machinery=machinery,
363360
abc=importlib_abc, util=importlib_util)
364361

362+
# TODO: RUSTPYTHON, get rid of this entire class when all of the following tests are fixed
363+
class Source_SimpleTest(Source_SimpleTest):
364+
# TODO: RUSTPYTHON, get rid of all three of the following lines when this test is fixed
365+
@unittest.expectedFailure
366+
def test_checked_hash_based_pyc(self):
367+
super().test_checked_hash_based_pyc()
368+
369+
# TODO: RUSTPYTHON, get rid of all three of the following lines when this test is fixed
370+
@unittest.expectedFailure
371+
def test_unchecked_hash_based_pyc(self):
372+
super().test_unchecked_hash_based_pyc()
373+
374+
# TODO: RUSTPYTHON, get rid of all three of the following lines when this test is fixed
375+
@unittest.expectedFailure
376+
def test_overridden_unchecked_hash_based_pyc(self):
377+
super().test_overridden_unchecked_hash_based_pyc()
378+
365379

366380
class SourceDateEpochTestMeta(SourceDateEpochTestMeta,
367381
type(Source_SimpleTest)):
@@ -677,24 +691,57 @@ class SourceLoaderBadBytecodeTestPEP451(
677691
pass
678692

679693

680-
# (Frozen_SourceBadBytecodePEP451,
681-
# Source_SourceBadBytecodePEP451
682-
# ) = util.test_both(SourceLoaderBadBytecodeTestPEP451, importlib=importlib,
683-
# machinery=machinery, abc=importlib_abc,
684-
# util=importlib_util)
694+
(Frozen_SourceBadBytecodePEP451,
695+
Source_SourceBadBytecodePEP451
696+
) = util.test_both(SourceLoaderBadBytecodeTestPEP451, importlib=importlib,
697+
machinery=machinery, abc=importlib_abc,
698+
util=importlib_util)
699+
700+
# TODO: RUSTPYTHON, get rid of this entire class when all of the following tests are fixed
701+
class Source_SourceBadBytecodePEP451(Source_SourceBadBytecodePEP451):
702+
# TODO: RUSTPYTHON, get rid of all three of the following lines when this test is fixed
703+
@unittest.expectedFailure
704+
def test_bad_marshal(self):
705+
super().test_bad_marshal()
706+
707+
# TODO: RUSTPYTHON, get rid of all three of the following lines when this test is fixed
708+
@unittest.expectedFailure
709+
def test_no_marshal(self):
710+
super().test_no_marshal()
711+
712+
# TODO: RUSTPYTHON, get rid of all three of the following lines when this test is fixed
713+
@unittest.expectedFailure
714+
def test_non_code_marshal(self):
715+
super().test_non_code_marshal()
716+
685717

718+
class SourceLoaderBadBytecodeTestPEP302(
719+
SourceLoaderBadBytecodeTest, BadBytecodeTestPEP302):
720+
pass
686721

687-
# TODO: RUSTPYTHON
688-
# class SourceLoaderBadBytecodeTestPEP302(
689-
# SourceLoaderBadBytecodeTest, BadBytecodeTestPEP302):
690-
# pass
691722

723+
(Frozen_SourceBadBytecodePEP302,
724+
Source_SourceBadBytecodePEP302
725+
) = util.test_both(SourceLoaderBadBytecodeTestPEP302, importlib=importlib,
726+
machinery=machinery, abc=importlib_abc,
727+
util=importlib_util)
692728

693-
# (Frozen_SourceBadBytecodePEP302,
694-
# Source_SourceBadBytecodePEP302
695-
# ) = util.test_both(SourceLoaderBadBytecodeTestPEP302, importlib=importlib,
696-
# machinery=machinery, abc=importlib_abc,
697-
# util=importlib_util)
729+
# TODO: RUSTPYTHON, get rid of this entire class when all of the following tests are fixed
730+
class Source_SourceBadBytecodePEP302(Source_SourceBadBytecodePEP302):
731+
# TODO: RUSTPYTHON, get rid of all three of the following lines when this test is fixed
732+
@unittest.expectedFailure
733+
def test_bad_marshal(self):
734+
super().test_bad_marshal()
735+
736+
# TODO: RUSTPYTHON, get rid of all three of the following lines when this test is fixed
737+
@unittest.expectedFailure
738+
def test_no_marshal(self):
739+
super().test_no_marshal()
740+
741+
# TODO: RUSTPYTHON, get rid of all three of the following lines when this test is fixed
742+
@unittest.expectedFailure
743+
def test_non_code_marshal(self):
744+
super().test_non_code_marshal()
698745

699746

700747
class SourcelessLoaderBadBytecodeTest:
@@ -776,23 +823,87 @@ class SourcelessLoaderBadBytecodeTestPEP451(SourcelessLoaderBadBytecodeTest,
776823
pass
777824

778825

779-
# (Frozen_SourcelessBadBytecodePEP451,
780-
# Source_SourcelessBadBytecodePEP451
781-
# ) = util.test_both(SourcelessLoaderBadBytecodeTestPEP451, importlib=importlib,
782-
# machinery=machinery, abc=importlib_abc,
783-
# util=importlib_util)
826+
(Frozen_SourcelessBadBytecodePEP451,
827+
Source_SourcelessBadBytecodePEP451
828+
) = util.test_both(SourcelessLoaderBadBytecodeTestPEP451, importlib=importlib,
829+
machinery=machinery, abc=importlib_abc,
830+
util=importlib_util)
831+
832+
# TODO: RUSTPYTHON, get rid of this entire class when all of the following tests are fixed
833+
class Source_SourcelessBadBytecodePEP451(Source_SourcelessBadBytecodePEP451):
834+
# TODO: RUSTPYTHON, get rid of all three of the following lines when this test is fixed
835+
@unittest.expectedFailure
836+
def test_magic_only(self):
837+
super().test_magic_only()
838+
839+
# TODO: RUSTPYTHON, get rid of all three of the following lines when this test is fixed
840+
@unittest.expectedFailure
841+
def test_no_marshal(self):
842+
super().test_no_marshal()
843+
844+
# TODO: RUSTPYTHON, get rid of all three of the following lines when this test is fixed
845+
@unittest.expectedFailure
846+
def test_partial_flags(self):
847+
super().test_partial_flags()
848+
849+
# TODO: RUSTPYTHON, get rid of all three of the following lines when this test is fixed
850+
@unittest.expectedFailure
851+
def test_partial_hash(self):
852+
super().test_partial_hash()
853+
854+
# TODO: RUSTPYTHON, get rid of all three of the following lines when this test is fixed
855+
@unittest.expectedFailure
856+
def test_partial_size(self):
857+
super().test_partial_size()
858+
859+
# TODO: RUSTPYTHON, get rid of all three of the following lines when this test is fixed
860+
@unittest.expectedFailure
861+
def test_partial_timestamp(self):
862+
super().test_partial_timestamp()
863+
864+
865+
class SourcelessLoaderBadBytecodeTestPEP302(SourcelessLoaderBadBytecodeTest,
866+
BadBytecodeTestPEP302):
867+
pass
868+
869+
870+
(Frozen_SourcelessBadBytecodePEP302,
871+
Source_SourcelessBadBytecodePEP302
872+
) = util.test_both(SourcelessLoaderBadBytecodeTestPEP302, importlib=importlib,
873+
machinery=machinery, abc=importlib_abc,
874+
util=importlib_util)
784875

876+
# TODO: RUSTPYTHON, get rid of this entire class when all of the following tests are fixed
877+
class Source_SourcelessBadBytecodePEP302(Source_SourcelessBadBytecodePEP302):
878+
# TODO: RUSTPYTHON, get rid of all three of the following lines when this test is fixed
879+
@unittest.expectedFailure
880+
def test_magic_only(self):
881+
super().test_magic_only()
785882

786-
# class SourcelessLoaderBadBytecodeTestPEP302(SourcelessLoaderBadBytecodeTest,
787-
# BadBytecodeTestPEP302):
788-
# pass
883+
# TODO: RUSTPYTHON, get rid of all three of the following lines when this test is fixed
884+
@unittest.expectedFailure
885+
def test_no_marshal(self):
886+
super().test_no_marshal()
789887

888+
# TODO: RUSTPYTHON, get rid of all three of the following lines when this test is fixed
889+
@unittest.expectedFailure
890+
def test_partial_flags(self):
891+
super().test_partial_flags()
790892

791-
# (Frozen_SourcelessBadBytecodePEP302,
792-
# Source_SourcelessBadBytecodePEP302
793-
# ) = util.test_both(SourcelessLoaderBadBytecodeTestPEP302, importlib=importlib,
794-
# machinery=machinery, abc=importlib_abc,
795-
# util=importlib_util)
893+
# TODO: RUSTPYTHON, get rid of all three of the following lines when this test is fixed
894+
@unittest.expectedFailure
895+
def test_partial_hash(self):
896+
super().test_partial_hash()
897+
898+
# TODO: RUSTPYTHON, get rid of all three of the following lines when this test is fixed
899+
@unittest.expectedFailure
900+
def test_partial_size(self):
901+
super().test_partial_size()
902+
903+
# TODO: RUSTPYTHON, get rid of all three of the following lines when this test is fixed
904+
@unittest.expectedFailure
905+
def test_partial_timestamp(self):
906+
super().test_partial_timestamp()
796907

797908

798909
if __name__ == '__main__':

0 commit comments

Comments
 (0)