Skip to content

Commit

Permalink
Merge d252691 into 0091e2b
Browse files Browse the repository at this point in the history
  • Loading branch information
jalavik committed Oct 9, 2015
2 parents 0091e2b + d252691 commit e8c2e26
Show file tree
Hide file tree
Showing 6 changed files with 75 additions and 40 deletions.
40 changes: 40 additions & 0 deletions .travis.invenio.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2015 CERN.
#
# Invenio is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later version.
#
# Invenio is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Invenio; if not, write to the Free Software Foundation, Inc.,
# 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.

"""Travis-CI configuration."""

import getpass

CFG_BIBSCHED_PROCESS_USER = getpass.getuser()

DEBUG = False
SECRET_KEY = 'MY_SECRET'

# Disable all automatic asset building - false is /usr/bin/false.
ASSETS_AUTO_BUILD = False

PACKAGES = [
'invenio_oaiharvester',
'invenio_workflows',
'invenio_accounts',
'invenio_records',
'invenio_formatter',
'invenio_upgrader',
'invenio_base',
]
8 changes: 4 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@ before_install:
- "python requirements.py --extras=$REXTRAS --level=min > .travis-lowest-requirements.txt"
- "python requirements.py --extras=$REXTRAS --level=pypi > .travis-release-requirements.txt"
- "python requirements.py --extras=$REXTRAS --level=dev > .travis-devel-requirements.txt"
- "mkdir -p ${VIRTUAL_ENV}/var/invenio.base-instance/"
- "cp .travis.invenio.cfg ${VIRTUAL_ENV}/var/invenio.base-instance/invenio.cfg"

install:
- "travis_retry pip install 'Invenio>=2.0.3'"
- "travis_retry pip install unittest2"
- "travis_retry pip install -r .travis-$REQUIREMENTS-requirements.txt --allow-all-external --quiet"
- "travis_retry pip install -e .[$REXTRAS] --quiet --process-dependency-links"
- "travis_retry pip install -r .travis-$REQUIREMENTS-requirements.txt --allow-all-external"
- "travis_retry pip install -e .[$REXTRAS]"

before_script:
- "inveniomanage database init --yes-i-know || echo ':('"
Expand Down
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ include *.in
include *.py
include *.rst
include *.txt
include .editorconfig .dockerignore .travis.yml .kwalitee.yml
include .editorconfig .dockerignore .travis.yml .kwalitee.yml .travis.invenio.cfg
include LICENSE
include babel.ini
include pytest.ini
Expand Down
24 changes: 13 additions & 11 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,24 +35,26 @@

requirements = [
'Flask>=0.10.1',
'invenio-base>=0.1.0',
'invenio-celery>=0.1.0',
'invenio-ext>=0.2.1',
'invenio-records>=0.2.0',
'invenio-upgrader>=0.1.0',
'invenio-utils>=0.1.1',
'invenio-workflows>=0.1.0',
'invenio-base>=0.3.1',
'invenio-celery>=0.1.1',
'invenio-ext>=0.3.1',
'invenio-records>=0.3.2',
'invenio-upgrader>=0.2.0',
'invenio-utils>=0.2.0',
'invenio-workflows>=0.1.1',
'sickle>=0.4', # FIXME grab next release for full arXiv.org support
'six>=1.7.2',
]

test_requirements = [
'Flask-Testing>=0.4.2',
'unittest2>=1.1.0',
'Flask_Testing>=0.4.1',
'pytest>=2.8.0',
'pytest-cov>=2.1.0',
'pytest-pep8>=1.0.6',
'pytest_cov>=2.1.0',
'pytest_pep8>=1.0.6',
'coverage>=4.0.0',
'httpretty>=0.8.3',
'invenio-testing>=0.1.0',
'responses>=0.4.0',
]


Expand Down
33 changes: 16 additions & 17 deletions tests/test_harvesting.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,26 @@
# 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.

import os
import httpretty
import responses

from invenio_oaiharvester.api import get_records
from invenio.testsuite import InvenioTestCase, make_test_suite, run_test_suite
from invenio_testing import InvenioTestCase


class OaiHarvesterTests(InvenioTestCase):

@httpretty.activate
@responses.activate
def test_get_from_identifiers(self):
raw_xml = open(os.path.join(
os.path.dirname(__file__), "data/sample_oai_dc_response.xml"
)).read()

httpretty.register_uri(httpretty.GET,
'http://export.arxiv.org/oai2',
body=raw_xml,
content_type='text/xml')
responses.add(
responses.GET,
'http://export.arxiv.org/oai2',
body=raw_xml,
content_type='text/xml'
)
for rec in get_records(['oai:arXiv.org:1507.03011'],
url='http://export.arxiv.org/oai2'):
identifier_in_request = rec.xml.xpath(
Expand All @@ -45,16 +47,18 @@ def test_get_from_identifiers(self):
self.assertEqual(identifier_in_request,
"http://arxiv.org/abs/1507.03011")

@httpretty.activate
@responses.activate
def test_get_from_identifiers_with_prefix(self):
raw_xml = open(os.path.join(
os.path.dirname(__file__), "data/sample_arxiv_response.xml"
)).read()

httpretty.register_uri(httpretty.GET,
'http://export.arxiv.org/oai2',
body=raw_xml,
content_type='text/xml')
responses.add(
responses.GET,
'http://export.arxiv.org/oai2',
body=raw_xml,
content_type='text/xml'
)
for rec in get_records(['oai:arXiv.org:1507.03011'],
metadata_prefix="arXiv",
url='http://export.arxiv.org/oai2'):
Expand All @@ -64,8 +68,3 @@ def test_get_from_identifiers_with_prefix(self):
)[0].text
self.assertEqual(identifier_in_request,
"1507.03011")

TEST_SUITE = make_test_suite(OaiHarvesterTests)

if __name__ == "__main__":
run_test_suite(TEST_SUITE)
8 changes: 1 addition & 7 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

import os

from invenio.testsuite import InvenioTestCase, make_test_suite, run_test_suite
from invenio_testing import InvenioTestCase


class OAIHarvesterUtils(InvenioTestCase):
Expand Down Expand Up @@ -107,9 +107,3 @@ def test_identifier_filter(self):
self.assertEqual(
get_identifier_names(sample),
["oai:mysite.com:1234/testing", "oai:example.com:record/1234"])


TEST_SUITE = make_test_suite(OAIHarvesterUtils)

if __name__ == "__main__":
run_test_suite(TEST_SUITE)

0 comments on commit e8c2e26

Please sign in to comment.