Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
swh-core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Platform
Development
swh-core
Commits
9a903dc0
Commit
9a903dc0
authored
4 years ago
by
vlorentz
Browse files
Options
Downloads
Patches
Plain Diff
tarball: add test for permissions.
parent
6d49f04a
No related branches found
Branches containing commit
Tags
swh-loader-highpriority-20230203.1
Tags containing commit
1 merge request
!153
tarball: add test for permissions.
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
swh/core/tests/test_tarball.py
+52
-0
52 additions, 0 deletions
swh/core/tests/test_tarball.py
with
52 additions
and
0 deletions
swh/core/tests/test_tarball.py
+
52
−
0
View file @
9a903dc0
...
...
@@ -44,6 +44,35 @@ def test_compress_uncompress_zip(tmp_path):
assert
[
"
file%s.txt
"
%
i
for
i
in
range
(
10
)]
==
lsdir
@pytest.mark.xfail
(
reason
=
(
"
Python
'
s zipfile library doesn
'
t support Info-ZIP
'
s
"
"
extension for file permissions.
"
)
)
def
test_compress_uncompress_zip_modes
(
tmp_path
):
tocompress
=
tmp_path
/
"
compressme
"
tocompress
.
mkdir
()
fpath
=
tocompress
/
"
text.txt
"
fpath
.
write_text
(
"
echo foo
"
)
fpath
.
chmod
(
0o644
)
fpath
=
tocompress
/
"
executable.sh
"
fpath
.
write_text
(
"
echo foo
"
)
fpath
.
chmod
(
0o755
)
zipfile
=
tmp_path
/
"
archive.zip
"
tarball
.
compress
(
str
(
zipfile
),
"
zip
"
,
str
(
tocompress
))
destdir
=
tmp_path
/
"
destdir
"
tarball
.
uncompress
(
str
(
zipfile
),
str
(
destdir
))
(
executable_path
,
text_path
)
=
sorted
(
destdir
.
iterdir
())
assert
text_path
.
stat
().
st_mode
==
0o100644
# succeeds, it's the default
assert
executable_path
.
stat
().
st_mode
==
0o100755
# fails
def
test_compress_uncompress_tar
(
tmp_path
):
tocompress
=
tmp_path
/
"
compressme
"
tocompress
.
mkdir
()
...
...
@@ -62,6 +91,29 @@ def test_compress_uncompress_tar(tmp_path):
assert
[
"
file%s.txt
"
%
i
for
i
in
range
(
10
)]
==
lsdir
def
test_compress_uncompress_tar_modes
(
tmp_path
):
tocompress
=
tmp_path
/
"
compressme
"
tocompress
.
mkdir
()
fpath
=
tocompress
/
"
text.txt
"
fpath
.
write_text
(
"
echo foo
"
)
fpath
.
chmod
(
0o644
)
fpath
=
tocompress
/
"
executable.sh
"
fpath
.
write_text
(
"
echo foo
"
)
fpath
.
chmod
(
0o755
)
tarfile
=
tmp_path
/
"
archive.tar
"
tarball
.
compress
(
str
(
tarfile
),
"
tar
"
,
str
(
tocompress
))
destdir
=
tmp_path
/
"
destdir
"
tarball
.
uncompress
(
str
(
tarfile
),
str
(
destdir
))
(
executable_path
,
text_path
)
=
sorted
(
destdir
.
iterdir
())
assert
text_path
.
stat
().
st_mode
==
0o100644
assert
executable_path
.
stat
().
st_mode
==
0o100755
def
test__unpack_tar_failure
(
tmp_path
,
datadir
):
"""
Unpack inexistent tarball should fail
...
...
This diff is collapsed.
Click to expand it.
Phabricator Migration user
@phabricator-migration
mentioned in merge request
!154 (closed)
·
2 years ago
mentioned in merge request
!154 (closed)
mentioned in merge request !154
Toggle commit list
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment