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
eaddf17b
Commit
eaddf17b
authored
Nov 24, 2013
by
Serhiy Storchaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Build a list of supported test tarfiles dynamically for CLI "test" command
tests (issue13477).
parent
745552a4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
3 deletions
+6
-3
Lib/test/test_tarfile.py
Lib/test/test_tarfile.py
+6
-3
No files found.
Lib/test/test_tarfile.py
View file @
eaddf17b
...
...
@@ -1745,13 +1745,13 @@ class CommandLineTest(unittest.TestCase):
tf
.
add
(
tardata
,
arcname
=
os
.
path
.
basename
(
tardata
))
def
test_test_command
(
self
):
for
tar_name
in
(
tarname
,
gzipname
,
bz2name
,
xzname
)
:
for
tar_name
in
testtarnames
:
for
opt
in
'-t'
,
'--test'
:
out
=
self
.
tarfilecmd
(
opt
,
tar_name
)
self
.
assertEqual
(
out
,
b''
)
def
test_test_command_verbose
(
self
):
for
tar_name
in
(
tarname
,
gzipname
,
bz2name
,
xzname
)
:
for
tar_name
in
testtarnames
:
for
opt
in
'-v'
,
'--verbose'
:
out
=
self
.
tarfilecmd
(
opt
,
'-t'
,
tar_name
)
self
.
assertIn
(
b'is a tar archive.
\
n
'
,
out
)
...
...
@@ -1763,7 +1763,7 @@ class CommandLineTest(unittest.TestCase):
self
.
assertEqual
(
out
,
b''
)
self
.
assertEqual
(
rc
,
1
)
for
tar_name
in
(
tarname
,
gzipname
,
bz2name
,
xzname
)
:
for
tar_name
in
testtarnames
:
with
self
.
subTest
(
tar_name
=
tar_name
):
with
open
(
tar_name
,
'rb'
)
as
f
:
data
=
f
.
read
()
...
...
@@ -2015,6 +2015,8 @@ def setUpModule():
support
.
unlink
(
TEMPDIR
)
os
.
makedirs
(
TEMPDIR
)
global
testtarnames
testtarnames
=
[
tarname
]
with
open
(
tarname
,
"rb"
)
as
fobj
:
data
=
fobj
.
read
()
...
...
@@ -2022,6 +2024,7 @@ def setUpModule():
for
c
in
GzipTest
,
Bz2Test
,
LzmaTest
:
if
c
.
open
:
support
.
unlink
(
c
.
tarname
)
testtarnames
.
append
(
c
.
tarname
)
with
c
.
open
(
c
.
tarname
,
"wb"
)
as
tar
:
tar
.
write
(
data
)
...
...
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