Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
swh-lister
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-lister
Commits
ac9993a0
Commit
ac9993a0
authored
2 years ago
by
Kumar Shivendu
Committed by
Kumar Shivendu
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
test(hex): Improve comments in the lister tests
parent
cfd9a693
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
swh/lister/hex/tests/test_lister.py
+5
-13
5 additions, 13 deletions
swh/lister/hex/tests/test_lister.py
with
5 additions
and
13 deletions
swh/lister/hex/tests/test_lister.py
+
5
−
13
View file @
ac9993a0
...
...
@@ -13,7 +13,6 @@ from swh.scheduler.interface import SchedulerInterface
@pytest.fixture
def
hexpm_page
(
datadir
):
def
get_page
(
page_id
:
int
):
# FIXME: Update the test data to match ?sort=name
text
=
Path
(
datadir
,
"
https_hex.pm
"
,
f
"
page
{
page_id
}
.json
"
).
read_text
()
page_result
=
json
.
loads
(
text
)
origins
=
[
origin
[
"
html_url
"
]
for
origin
in
page_result
]
...
...
@@ -114,9 +113,7 @@ def test_hex_incremental_lister(
p3_origin_urls
,
p3_json
=
hexpm_page
(
3
)
mock_hexpm_page
(
3
,
"
2019-03-27T00:32:47.822901Z
"
,
p3_json
)
mock_hexpm_page
(
4
,
"
2022-09-09T21:00:14.993273Z
"
,
[]
)
# TODO: Try with 40x/50x here?
mock_hexpm_page
(
4
,
"
2022-09-09T21:00:14.993273Z
"
,
[])
stats
=
lister
.
run
()
...
...
@@ -126,9 +123,7 @@ def test_hex_incremental_lister(
scheduler_origins
=
swh_scheduler
.
get_listed_origins
(
lister
.
lister_obj
.
id
).
results
lister_state
=
lister
.
get_state_from_scheduler
()
assert
(
lister_state
.
last_page_id
==
4
)
# TODO: Shouldn't this be 3 given that P4 is empty?
assert
lister_state
.
last_page_id
==
4
assert
lister
.
state
.
last_pkg_name
==
"
logger_dev
"
assert
lister
.
updated
...
...
@@ -139,17 +134,15 @@ def test_hex_incremental_lister(
lister
.
updated
=
False
# Reset the flag
# Third run: No new origins
# The lister should revisit the last page (P
3
)
# The lister should revisit the last page (P
4
)
stats
=
lister
.
run
()
assert
stats
.
pages
==
1
assert
stats
.
origins
==
0
# FIXME: inconsistent with Gogs lister
assert
stats
.
origins
==
0
lister_state
=
lister
.
get_state_from_scheduler
()
assert
(
lister_state
.
last_page_id
==
4
)
# TODO: Shouldn't this be 3 given that P4 is empty?
assert
lister_state
.
last_page_id
==
4
assert
lister
.
state
.
last_pkg_name
==
"
logger_dev
"
assert
lister
.
updated
is
False
# No new origins so state isn't updated
...
...
@@ -163,7 +156,6 @@ def test_hex_lister_http_error(swh_scheduler, http_code, mock_hexpm_page, hexpm_
"""
Test handling of some HTTP errors commonly encountered
"""
lister
=
HexLister
(
swh_scheduler
)
# First run: P1 and P2 return 4 origins each and P3 returns 0
p1_origin_urls
,
p1_json
=
hexpm_page
(
1
)
_
,
p3_json
=
hexpm_page
(
3
)
...
...
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