summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_zipimport.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2018-09-19 14:43:33 (GMT)
committerGitHub <noreply@github.com>2018-09-19 14:43:33 (GMT)
commitb2984ab9a7c458f8b7ed8978c0c95b109116895d (patch)
treec179bc715f62eecbf734e889f30acbc7aae0a52e /Lib/test/test_zipimport.py
parent3705b9862025705ea60041a9e310f99a164db722 (diff)
downloadcpython-b2984ab9a7c458f8b7ed8978c0c95b109116895d.zip
cpython-b2984ab9a7c458f8b7ed8978c0c95b109116895d.tar.gz
cpython-b2984ab9a7c458f8b7ed8978c0c95b109116895d.tar.bz2
bpo-25711: Remove outdated zipimport tests. (GH-9404)
They were specific to the C implementation.
Diffstat (limited to 'Lib/test/test_zipimport.py')
-rw-r--r--Lib/test/test_zipimport.py49
1 files changed, 0 insertions, 49 deletions
diff --git a/Lib/test/test_zipimport.py b/Lib/test/test_zipimport.py
index cad73ea..63e5672 100644
--- a/Lib/test/test_zipimport.py
+++ b/Lib/test/test_zipimport.py
@@ -539,28 +539,6 @@ class UncompressedZipImportTestCase(ImportHooksBaseTestCase):
z.close()
os.remove(TEMP_ZIP)
- def test_issue31291(self):
- # There shouldn't be an assertion failure in get_data().
- class FunnyStr(str):
- def replace(self, old, new):
- return 42
- z = ZipFile(TEMP_ZIP, "w")
- try:
- name = "test31291.dat"
- data = b'foo'
- z.writestr(name, data)
- z.close()
- zi = zipimport.zipimporter(TEMP_ZIP)
- try:
- data2 = zi.get_data(FunnyStr(name))
- except AttributeError:
- pass
- else:
- self.assertEqual(data2, data)
- finally:
- z.close()
- os.remove(TEMP_ZIP)
-
def testImporterAttr(self):
src = """if 1: # indent hack
def get_file():
@@ -687,38 +665,11 @@ class UncompressedZipImportTestCase(ImportHooksBaseTestCase):
with self.assertRaises(TypeError):
zipimport.zipimporter(memoryview(os.fsencode(filename)))
- @support.cpython_only
- def testUninitializedZipimporter(self):
- # The interpreter shouldn't crash in case of calling methods of an
- # uninitialized zipimport.zipimporter object.
- zi = zipimport.zipimporter.__new__(zipimport.zipimporter)
- self.assertRaises((ValueError, AttributeError), zi.find_module, 'foo')
- self.assertRaises((ValueError, AttributeError), zi.find_loader, 'foo')
- self.assertRaises((ValueError, AttributeError), zi.load_module, 'foo')
- self.assertRaises((ValueError, AttributeError), zi.get_filename, 'foo')
- self.assertRaises((ValueError, AttributeError), zi.is_package, 'foo')
- self.assertRaises((ValueError, AttributeError), zi.get_data, 'foo')
- self.assertRaises((ValueError, AttributeError), zi.get_code, 'foo')
- self.assertRaises((ValueError, AttributeError), zi.get_source, 'foo')
-
@support.requires_zlib
class CompressedZipImportTestCase(UncompressedZipImportTestCase):
compression = ZIP_DEFLATED
- @support.cpython_only
- def test_issue31602(self):
- # There shouldn't be an assertion failure in zipimporter.get_source()
- # in case of a bad zlib.decompress().
- def bad_decompress(*args):
- return None
- with ZipFile(TEMP_ZIP, 'w') as zip_file:
- self.addCleanup(support.unlink, TEMP_ZIP)
- zip_file.writestr('bar.py', b'print("hello world")', ZIP_DEFLATED)
- zi = zipimport.zipimporter(TEMP_ZIP)
- with support.swap_attr(zlib, 'decompress', bad_decompress):
- self.assertRaises((TypeError, AttributeError), zi.get_source, 'bar')
-
class BadFileZipImportTestCase(unittest.TestCase):
def assertZipFailure(self, filename):