Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
swh-vault
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
Package registry
Model registry
Operate
Environments
Terraform modules
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
Nicolas Dandrimont
swh-vault
Commits
da0ec08c
Commit
da0ec08c
authored
2 years ago
by
vlorentz
Browse files
Options
Downloads
Patches
Plain Diff
Fix pytest warning about TestRepo being uncollectable
parent
e8d362ca
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
swh/vault/tests/test_cookers.py
+16
-16
16 additions, 16 deletions
swh/vault/tests/test_cookers.py
with
16 additions
and
16 deletions
swh/vault/tests/test_cookers.py
+
16
−
16
View file @
da0ec08c
...
...
@@ -47,7 +47,7 @@ from swh.vault.tests.vault_testing import hash_content
from
swh.vault.to_disk
import
HIDDEN_MESSAGE
,
SKIPPED_MESSAGE
class
TestRepo
:
class
_
TestRepo
:
"""
A tiny context manager for a test git repository, with some utility
functions to perform basic git stuff.
"""
...
...
@@ -198,7 +198,7 @@ def cook_extract_directory_dircooker(storage, swhid, fsck=True):
def
cook_extract_directory_gitfast
(
storage
,
swhid
,
fsck
=
True
):
"""
Context manager that cooks a revision containing a directory and extract it,
using RevisionGitfastCooker
"""
test_repo
=
TestRepo
()
test_repo
=
_
TestRepo
()
with
test_repo
as
p
:
date
=
TimestampWithTimezone
.
from_datetime
(
datetime
.
datetime
.
now
(
datetime
.
timezone
.
utc
)
...
...
@@ -298,7 +298,7 @@ def cook_stream_revision_gitfast(storage, swhid):
def
cook_extract_revision_gitfast
(
storage
,
swhid
,
fsck
=
True
):
"""
Context manager that cooks a revision and extract it,
using RevisionGitfastCooker
"""
test_repo
=
TestRepo
()
test_repo
=
_
TestRepo
()
with
cook_stream_revision_gitfast
(
storage
,
swhid
)
as
stream
,
test_repo
as
p
:
processor
=
dulwich
.
fastexport
.
GitImportProcessor
(
test_repo
.
repo
)
processor
.
import_stream
(
stream
)
...
...
@@ -336,7 +336,7 @@ def cook_extract_git_bare(storage, swhid, fsck=True):
clone_dir
,
]
)
test_repo
=
TestRepo
(
clone_dir
)
test_repo
=
_
TestRepo
(
clone_dir
)
with
test_repo
:
yield
test_repo
,
clone_dir
...
...
@@ -389,7 +389,7 @@ TEST_EXECUTABLE = b"\x42\x40\x00\x00\x05"
class
TestDirectoryCooker
:
def
test_directory_simple
(
self
,
git_loader
,
cook_extract_directory
):
repo
=
TestRepo
()
repo
=
_
TestRepo
()
with
repo
as
rp
:
(
rp
/
"
file
"
).
write_text
(
TEST_CONTENT
)
(
rp
/
"
executable
"
).
write_bytes
(
TEST_EXECUTABLE
)
...
...
@@ -419,7 +419,7 @@ class TestDirectoryCooker:
assert
obj_id_hex
==
hashutil
.
hash_to_hex
(
directory
.
hash
)
def
test_directory_filtered_objects
(
self
,
git_loader
,
cook_extract_directory
):
repo
=
TestRepo
()
repo
=
_
TestRepo
()
with
repo
as
rp
:
file_1
,
id_1
=
hash_content
(
b
"
test1
"
)
file_2
,
id_2
=
hash_content
(
b
"
test2
"
)
...
...
@@ -466,7 +466,7 @@ class TestDirectoryCooker:
# Some early git repositories have 664/775 permissions... let's check
# if all the weird modes are properly normalized in the directory
# cooker.
repo
=
TestRepo
()
repo
=
_
TestRepo
()
with
repo
as
rp
:
(
rp
/
"
file
"
).
write_text
(
TEST_CONTENT
)
(
rp
/
"
file
"
).
chmod
(
0o664
)
...
...
@@ -516,7 +516,7 @@ class TestDirectoryCooker:
):
"""
Like test_directory_simple, but using swh_objstorage directly, without
going through swh_storage.content_get_data()
"""
repo
=
TestRepo
()
repo
=
_
TestRepo
()
with
repo
as
rp
:
(
rp
/
"
file
"
).
write_text
(
TEST_CONTENT
)
(
rp
/
"
executable
"
).
write_bytes
(
TEST_EXECUTABLE
)
...
...
@@ -592,7 +592,7 @@ class RepoFixtures:
#
# 1--2--3--4--5--6--7
#
repo
=
TestRepo
()
repo
=
_
TestRepo
()
with
repo
as
rp
:
(
rp
/
"
file1
"
).
write_text
(
TEST_CONTENT
)
repo
.
commit
(
"
add file1
"
)
...
...
@@ -635,7 +635,7 @@ class RepoFixtures:
# /
# 2----
#
repo
=
TestRepo
()
repo
=
_
TestRepo
()
with
repo
as
rp
:
(
rp
/
"
file1
"
).
write_text
(
TEST_CONTENT
)
c1
=
repo
.
commit
(
"
Add file1
"
)
...
...
@@ -664,7 +664,7 @@ class RepoFixtures:
# \
# ----3 <-- b2
#
repo
=
TestRepo
()
repo
=
_
TestRepo
()
with
repo
as
rp
:
(
rp
/
"
file1
"
).
write_text
(
TEST_CONTENT
)
repo
.
commit
(
"
Add file1
"
)
...
...
@@ -709,7 +709,7 @@ class RepoFixtures:
# / / /
# 1---3---5
#
repo
=
TestRepo
()
repo
=
_
TestRepo
()
with
repo
as
rp
:
(
rp
/
"
file1
"
).
write_text
(
TEST_CONTENT
)
c1
=
repo
.
commit
(
"
Add file1
"
)
# create commit 1
...
...
@@ -762,7 +762,7 @@ class RepoFixtures:
# / / /
# 1---.---.
#
repo
=
TestRepo
()
repo
=
_
TestRepo
()
with
repo
as
rp
:
(
rp
/
"
file1
"
).
write_text
(
TEST_CONTENT
)
c1
=
repo
.
commit
(
"
Commit 1
"
)
...
...
@@ -804,7 +804,7 @@ class RepoFixtures:
)
def
load_repo_filtered_objects
(
self
,
git_loader
):
repo
=
TestRepo
()
repo
=
_
TestRepo
()
with
repo
as
rp
:
file_1
,
id_1
=
hash_content
(
b
"
test1
"
)
file_2
,
id_2
=
hash_content
(
b
"
test2
"
)
...
...
@@ -852,7 +852,7 @@ class RepoFixtures:
def
load_repo_null_fields
(
self
,
git_loader
):
# Our schema doesn't enforce a lot of non-null revision fields. We need
# to check these cases don't break the cooker.
repo
=
TestRepo
()
repo
=
_
TestRepo
()
with
repo
as
rp
:
(
rp
/
"
file
"
).
write_text
(
TEST_CONTENT
)
c
=
repo
.
commit
(
"
initial commit
"
)
...
...
@@ -890,7 +890,7 @@ class RepoFixtures:
# \
# ----3----4 <-- t4a (annotated)
#
repo
=
TestRepo
()
repo
=
_
TestRepo
()
with
repo
as
rp
:
(
rp
/
"
file1
"
).
write_text
(
TEST_CONTENT
)
repo
.
commit
(
"
Add file1
"
)
...
...
This diff is collapsed.
Click to expand it.
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