Docker-in-Docker (DinD) capabilities of public runners deactivated. More info

Commit be6ae624 authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Migrate Preprints.

parent 29725268
......@@ -25,10 +25,12 @@ class Preprints(Automaton):
"""Check the content of the preprint in order to fix non conformities.
Args:
record (RecordPubli): record describing a preprint.
record (RecordPubli):
record describing a preprint.
Returns:
bool: ``False`` when a non conformity is found and can not be
bool:
``False`` when a non conformity is found and can not be
corrected.
"""
......@@ -56,7 +58,6 @@ class Preprints(Automaton):
try:
self.check.submitted(record)
self.check.year(record)
self.check.format_authors(record, fmt="F. Last")
self.check.get_my_authors(record, sort=True)
......@@ -76,10 +77,12 @@ class Preprints(Automaton):
"""Insert a preprint in the database.
Args:
record (RecordPubli): record describing a preprint.
record (RecordPubli):
record describing a preprint.
Returns:
int: one when the record is inserted / updated in the database
int:
one when the record is inserted / updated in the database
zero otherwise.
"""
......@@ -88,8 +91,8 @@ class Preprints(Automaton):
oai_url = record.oai_url()
preprint = record.preprint_number()
title = record.title()
submitted = record.submitted()[0]
year = record.year()
submitted = record.submitted()
year = submitted[0:4]
# get the collaboration identifier
id_collaboration = self.search_collaboration(record.collaboration())
......
# -*- coding: utf-8 -*-
"""test_Preprint
* Harvester is Preprints
* Store is cds.cern.ch
* LHCb PRE for the current year
* Check that all error messages are expected
"""
import pytest
from gluon import current
from harvest_tools.preprints import Preprints
from harvest_tools.factory import build_harvester_tool
from test_tools import messages
@pytest.fixture(scope="module")
def harvester_messages():
return messages()
def test_lhcb_pre(harvester_messages):
"""Harvest LHCb preprint for a given year.
This test is useful to:
* debug an harvester
* profile its performance to see where the time is spent.
* compare different implementation to measure improvements.
* ...
"""
# These parameter only make sense if you are inserting record in database
# Select the current year in order to test different case
db = current.db
id_team = 7 # LHCb
id_project = 8 # LHCb
id_category = 15 # PRE
year = current.request.now.year
# build the harvester
tool = build_harvester_tool(
db,
id_team,
id_project,
"preprints",
id_category,
year_start=str(year),
year_end="",
dry_run=True,
debug=True)
assert isinstance(tool, Preprints)
# run the harvester
tool.process_url("cds.cern.ch", "LHCb Papers")
# analyse the log
# Number of talk cannot be check since it evolve within a year
# Only test that there are no unexpected messages
msgs = set([el.txt for el in tool.logs])
assert msgs.issubset(harvester_messages)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment