Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Paste
P1105
hg extid version test
Active
Public
Actions
Authored by
vlorentz
on Jul 29 2021, 10:48 AM.
Edit Paste
Archive Paste
View Raw File
Subscribe
Mute Notifications
Award Token
Flag For Later
Tags
None
Subscribers
None
def
test_load_new_extid_should_be_eventful
(
swh_storage
,
datadir
,
tmp_path
):
"""Changing the extid version should make loaders ignore existing extids,
and load the repo again."""
archive_name
=
"hello"
archive_path
=
os
.
path
.
join
(
datadir
,
f
"{archive_name}.tgz"
)
repo_url
=
prepare_repository_from_archive
(
archive_path
,
archive_name
,
tmp_path
)
repo_path
=
repo_url
.
replace
(
"file://"
,
""
)
loader
=
HgLoaderFromDisk
(
swh_storage
,
repo_path
)
with
unittest
.
mock
.
patch
(
"swh.loader.mercurial.from_disk.EXTID_VERSION"
,
0
):
assert
loader
.
load
()
==
{
"status"
:
"eventful"
}
assert
loader
.
load
()
==
{
"status"
:
"eventful"
}
assert
loader
.
load
()
==
{
"status"
:
"uneventful"
}
with
unittest
.
mock
.
patch
(
"swh.loader.mercurial.from_disk.EXTID_VERSION"
,
10000
):
assert
loader
.
load
()
==
{
"status"
:
"eventful"
}
assert
loader
.
load
()
==
{
"status"
:
"uneventful"
}
Event Timeline
vlorentz
created this paste.
Jul 29 2021, 10:48 AM
2021-07-29 10:48:37 (UTC+2)
Log In to Comment