Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
171 changes: 141 additions & 30 deletions Lib/test/test_importlib/source/test_file_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,6 @@ def test_unloadable(self):
warnings.simplefilter('ignore', DeprecationWarning)
loader.load_module('bad name')

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

@unittest.skip("TODO: RUSTPYTHON; successful only for Frozen")
@util.writes_bytecode_files
def test_unchecked_hash_based_pyc(self):
with util.create_modules('_temp') as mapping:
Expand Down Expand Up @@ -324,7 +322,6 @@ def test_unchecked_hash_based_pyc(self):
data[8:16],
)

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

# TODO: RUSTPYTHON, get rid of this entire class when all of the following tests are fixed
class Source_SimpleTest(Source_SimpleTest):
# TODO: RUSTPYTHON, get rid of all three of the following lines when this test is fixed
@unittest.expectedFailure
def test_checked_hash_based_pyc(self):
super().test_checked_hash_based_pyc()

# TODO: RUSTPYTHON, get rid of all three of the following lines when this test is fixed
@unittest.expectedFailure
def test_unchecked_hash_based_pyc(self):
super().test_unchecked_hash_based_pyc()

# TODO: RUSTPYTHON, get rid of all three of the following lines when this test is fixed
@unittest.expectedFailure
def test_overridden_unchecked_hash_based_pyc(self):
super().test_overridden_unchecked_hash_based_pyc()


class SourceDateEpochTestMeta(SourceDateEpochTestMeta,
type(Source_SimpleTest)):
Expand Down Expand Up @@ -677,24 +691,57 @@ class SourceLoaderBadBytecodeTestPEP451(
pass


# (Frozen_SourceBadBytecodePEP451,
# Source_SourceBadBytecodePEP451
# ) = util.test_both(SourceLoaderBadBytecodeTestPEP451, importlib=importlib,
# machinery=machinery, abc=importlib_abc,
# util=importlib_util)
(Frozen_SourceBadBytecodePEP451,
Source_SourceBadBytecodePEP451
) = util.test_both(SourceLoaderBadBytecodeTestPEP451, importlib=importlib,
machinery=machinery, abc=importlib_abc,
util=importlib_util)

# TODO: RUSTPYTHON, get rid of this entire class when all of the following tests are fixed
class Source_SourceBadBytecodePEP451(Source_SourceBadBytecodePEP451):
# TODO: RUSTPYTHON, get rid of all three of the following lines when this test is fixed
@unittest.expectedFailure
def test_bad_marshal(self):
super().test_bad_marshal()

# TODO: RUSTPYTHON, get rid of all three of the following lines when this test is fixed
@unittest.expectedFailure
def test_no_marshal(self):
super().test_no_marshal()

# TODO: RUSTPYTHON, get rid of all three of the following lines when this test is fixed
@unittest.expectedFailure
def test_non_code_marshal(self):
super().test_non_code_marshal()


class SourceLoaderBadBytecodeTestPEP302(
SourceLoaderBadBytecodeTest, BadBytecodeTestPEP302):
pass

# TODO: RUSTPYTHON
# class SourceLoaderBadBytecodeTestPEP302(
# SourceLoaderBadBytecodeTest, BadBytecodeTestPEP302):
# pass

(Frozen_SourceBadBytecodePEP302,
Source_SourceBadBytecodePEP302
) = util.test_both(SourceLoaderBadBytecodeTestPEP302, importlib=importlib,
machinery=machinery, abc=importlib_abc,
util=importlib_util)

# (Frozen_SourceBadBytecodePEP302,
# Source_SourceBadBytecodePEP302
# ) = util.test_both(SourceLoaderBadBytecodeTestPEP302, importlib=importlib,
# machinery=machinery, abc=importlib_abc,
# util=importlib_util)
# TODO: RUSTPYTHON, get rid of this entire class when all of the following tests are fixed
class Source_SourceBadBytecodePEP302(Source_SourceBadBytecodePEP302):
# TODO: RUSTPYTHON, get rid of all three of the following lines when this test is fixed
@unittest.expectedFailure
def test_bad_marshal(self):
super().test_bad_marshal()

# TODO: RUSTPYTHON, get rid of all three of the following lines when this test is fixed
@unittest.expectedFailure
def test_no_marshal(self):
super().test_no_marshal()

# TODO: RUSTPYTHON, get rid of all three of the following lines when this test is fixed
@unittest.expectedFailure
def test_non_code_marshal(self):
super().test_non_code_marshal()


class SourcelessLoaderBadBytecodeTest:
Expand Down Expand Up @@ -776,23 +823,87 @@ class SourcelessLoaderBadBytecodeTestPEP451(SourcelessLoaderBadBytecodeTest,
pass


# (Frozen_SourcelessBadBytecodePEP451,
# Source_SourcelessBadBytecodePEP451
# ) = util.test_both(SourcelessLoaderBadBytecodeTestPEP451, importlib=importlib,
# machinery=machinery, abc=importlib_abc,
# util=importlib_util)
(Frozen_SourcelessBadBytecodePEP451,
Source_SourcelessBadBytecodePEP451
) = util.test_both(SourcelessLoaderBadBytecodeTestPEP451, importlib=importlib,
machinery=machinery, abc=importlib_abc,
util=importlib_util)

# TODO: RUSTPYTHON, get rid of this entire class when all of the following tests are fixed
class Source_SourcelessBadBytecodePEP451(Source_SourcelessBadBytecodePEP451):
# TODO: RUSTPYTHON, get rid of all three of the following lines when this test is fixed
@unittest.expectedFailure
def test_magic_only(self):
super().test_magic_only()

# TODO: RUSTPYTHON, get rid of all three of the following lines when this test is fixed
@unittest.expectedFailure
def test_no_marshal(self):
super().test_no_marshal()

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

# TODO: RUSTPYTHON, get rid of all three of the following lines when this test is fixed
@unittest.expectedFailure
def test_partial_hash(self):
super().test_partial_hash()

# TODO: RUSTPYTHON, get rid of all three of the following lines when this test is fixed
@unittest.expectedFailure
def test_partial_size(self):
super().test_partial_size()

# TODO: RUSTPYTHON, get rid of all three of the following lines when this test is fixed
@unittest.expectedFailure
def test_partial_timestamp(self):
super().test_partial_timestamp()


class SourcelessLoaderBadBytecodeTestPEP302(SourcelessLoaderBadBytecodeTest,
BadBytecodeTestPEP302):
pass


(Frozen_SourcelessBadBytecodePEP302,
Source_SourcelessBadBytecodePEP302
) = util.test_both(SourcelessLoaderBadBytecodeTestPEP302, importlib=importlib,
machinery=machinery, abc=importlib_abc,
util=importlib_util)

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

# class SourcelessLoaderBadBytecodeTestPEP302(SourcelessLoaderBadBytecodeTest,
# BadBytecodeTestPEP302):
# pass
# TODO: RUSTPYTHON, get rid of all three of the following lines when this test is fixed
@unittest.expectedFailure
def test_no_marshal(self):
super().test_no_marshal()

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

# (Frozen_SourcelessBadBytecodePEP302,
# Source_SourcelessBadBytecodePEP302
# ) = util.test_both(SourcelessLoaderBadBytecodeTestPEP302, importlib=importlib,
# machinery=machinery, abc=importlib_abc,
# util=importlib_util)
# TODO: RUSTPYTHON, get rid of all three of the following lines when this test is fixed
@unittest.expectedFailure
def test_partial_hash(self):
super().test_partial_hash()

# TODO: RUSTPYTHON, get rid of all three of the following lines when this test is fixed
@unittest.expectedFailure
def test_partial_size(self):
super().test_partial_size()

# TODO: RUSTPYTHON, get rid of all three of the following lines when this test is fixed
@unittest.expectedFailure
def test_partial_timestamp(self):
super().test_partial_timestamp()


if __name__ == '__main__':
Expand Down
Loading