Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
b2984ab9
Commit
b2984ab9
authored
Sep 19, 2018
by
Serhiy Storchaka
Committed by
GitHub
Sep 19, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bpo-25711: Remove outdated zipimport tests. (GH-9404)
They were specific to the C implementation.
parent
3705b986
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
49 deletions
+0
-49
Lib/test/test_zipimport.py
Lib/test/test_zipimport.py
+0
-49
No files found.
Lib/test/test_zipimport.py
View file @
b2984ab9
...
...
@@ -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
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment