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
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-lister
Commits
e1069f0c
Verified
Commit
e1069f0c
authored
5 years ago
by
Antoine R. Dumont
Browse files
Options
Downloads
Patches
Plain Diff
cran.lister: Align loading tasks' with loader's expectation
parent
3f3f714c
No related branches found
Branches containing commit
Tags
v0.0.47
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
swh/lister/cran/lister.py
+2
-4
2 additions, 4 deletions
swh/lister/cran/lister.py
swh/lister/cran/tests/conftest.py
+18
-1
18 additions, 1 deletion
swh/lister/cran/tests/conftest.py
swh/lister/cran/tests/test_lister.py
+9
-17
9 additions, 17 deletions
swh/lister/cran/tests/test_lister.py
with
29 additions
and
22 deletions
swh/lister/cran/lister.py
+
2
−
4
View file @
e1069f0c
...
...
@@ -33,13 +33,11 @@ class CRANLister(SimpleLister):
"""
policy
=
kwargs
.
get
(
'
policy
'
,
'
oneshot
'
)
package
=
kwargs
.
get
(
'
name
'
)
version
=
kwargs
.
get
(
'
version
'
)
assert
origin_type
==
'
tar
'
return
create_task_dict
(
'
load-archive-files
'
,
policy
,
package
,
origin_url
,
version
,
retries_left
=
3
,
'
load-cran
'
,
policy
,
url
=
origin_url
,
version
=
version
,
retries_left
=
3
)
def
safely_issue_request
(
self
,
identifier
):
...
...
This diff is collapsed.
Click to expand it.
swh/lister/cran/tests/conftest.py
+
18
−
1
View file @
e1069f0c
# Copyright (C) 2019 The Software Heritage developers
# Copyright (C) 2019
-2020
The Software Heritage developers
# See the AUTHORS file at the top-level directory of this distribution
# License: GNU General Public License version 3, or any later version
# See top-level LICENSE file for more information
import
pytest
from
swh.lister.core.tests.conftest
import
*
# noqa
@pytest.fixture
def
lister_cran
(
swh_listers
):
lister
=
swh_listers
[
'
cran
'
]
# Add the load-deb-package in the scheduler backend
lister
.
scheduler
.
create_task_type
({
'
type
'
:
'
load-cran
'
,
'
description
'
:
'
Load a CRAN package
'
,
'
backend_name
'
:
'
swh.loader.package.cran.tasks.LoaderCRAN
'
,
'
default_interval
'
:
'
1 day
'
,
})
return
lister
This diff is collapsed.
Click to expand it.
swh/lister/cran/tests/test_lister.py
+
9
−
17
View file @
e1069f0c
# Copyright (C) 2019 The Software Heritage developers
# Copyright (C) 2019
-2020
The Software Heritage developers
# See the AUTHORS file at the top-level directory of this distribution
# License: GNU General Public License version 3, or any later version
# See top-level LICENSE file for more information
...
...
@@ -28,8 +28,8 @@ def test_cran_compute_package_url_failure():
@patch
(
'
swh.lister.cran.lister.read_cran_data
'
)
def
test_cran_lister_cran
(
mock_cran
,
datadir
,
swh_
lister
s
):
lister
=
swh_
lister
s
[
'
cran
'
]
def
test_cran_lister_cran
(
mock_cran
,
datadir
,
lister
_cran
):
lister
=
lister
_
cran
with
open
(
path
.
join
(
datadir
,
'
list-r-packages.json
'
))
as
f
:
data
=
json
.
loads
(
f
.
read
())
...
...
@@ -39,27 +39,19 @@ def test_cran_lister_cran(mock_cran, datadir, swh_listers):
lister
.
run
()
r
=
lister
.
scheduler
.
search_tasks
(
task_type
=
'
load-
archive-files
'
)
r
=
lister
.
scheduler
.
search_tasks
(
task_type
=
'
load-
cran
'
)
assert
len
(
r
)
==
6
for
row
in
r
:
assert
row
[
'
type
'
]
==
'
load-
archive-files
'
assert
row
[
'
type
'
]
==
'
load-
cran
'
# arguments check
args
=
row
[
'
arguments
'
][
'
args
'
]
assert
len
(
args
)
==
3
# ['SeleMix',
# 'https://cran.r-project.org/src/contrib/SeleMix_1.0.1.tar.gz',
# '1.0.1']
package
=
args
[
0
]
url
=
args
[
1
]
version
=
args
[
2
]
assert
url
==
compute_package_url
(
{
'
Package
'
:
package
,
'
Version
'
:
version
})
assert
len
(
args
)
==
0
# kwargs
kwargs
=
row
[
'
arguments
'
][
'
kwargs
'
]
assert
kwargs
==
{}
assert
len
(
kwargs
)
==
2
assert
set
(
kwargs
.
keys
())
==
{
'
url
'
,
'
version
'
}
assert
row
[
'
policy
'
]
==
'
oneshot
'
assert
row
[
'
retries_left
'
]
==
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