Skip to content

Commit

Permalink
global: fix release check
Browse files Browse the repository at this point in the history
Signed-off-by: Leonardo Rossi <leonardo.r@cern.ch>
  • Loading branch information
Leonardo Rossi committed May 29, 2017
1 parent 15cf57b commit ce0e528
Show file tree
Hide file tree
Showing 17 changed files with 151 additions and 94 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ coverage.xml

# Translations
*.mo
*.pot

# Django stuff:
*.log
Expand Down
3 changes: 0 additions & 3 deletions examples/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,13 @@
from invenio_accounts.views import blueprint as accounts_blueprint
from invenio_admin import InvenioAdmin
from invenio_db import InvenioDB
from invenio_i18n import InvenioI18N
from invenio_records import InvenioRecords

from invenio_pidstore import InvenioPIDStore

# Create Flask application
app = Flask(__name__)
app.config.update(
I18N_LANGUAGES=[("da", "Danish"), ("en", "English")],
SECRET_KEY='test_key',
SECURITY_PASSWORD_HASH='pbkdf2_sha512',
SECURITY_PASSWORD_SALT="CHANGE_ME_ALSO",
Expand All @@ -96,7 +94,6 @@
)

Babel(app)
InvenioI18N(app)
Menu(app)
InvenioDB(app)
admin = InvenioAdmin(app)
Expand Down
72 changes: 72 additions & 0 deletions invenio_pidstore/translations/messages.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# Translations template for invenio-pidstore.
# Copyright (C) 2016 CERN
# This file is distributed under the same license as the invenio-pidstore
# project.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2016.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: invenio-pidstore 1.0.0a10.dev20160704\n"
"Report-Msgid-Bugs-To: info@inveniosoftware.org\n"
"POT-Creation-Date: 2016-07-26 08:52+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 2.3.4\n"

#: invenio_pidstore/admin.py:41
msgid "View"
msgstr ""

#: invenio_pidstore/admin.py:66
msgid "PID Type"
msgstr ""

#: invenio_pidstore/admin.py:67
msgid "PID"
msgstr ""

#: invenio_pidstore/admin.py:68
msgid "Provider"
msgstr ""

#: invenio_pidstore/admin.py:69 invenio_pidstore/admin.py:76
msgid "Status"
msgstr ""

#: invenio_pidstore/admin.py:70
msgid "Object Type"
msgstr ""

#: invenio_pidstore/admin.py:71 invenio_pidstore/admin.py:75
msgid "Object UUID"
msgstr ""

#: invenio_pidstore/admin.py:88
msgid "Records"
msgstr ""

#: invenio_pidstore/models.py:52
msgid "New"
msgstr ""

#: invenio_pidstore/models.py:53
msgid "Reserved"
msgstr ""

#: invenio_pidstore/models.py:54
msgid "Registered"
msgstr ""

#: invenio_pidstore/models.py:55
msgid "Redirected"
msgstr ""

#: invenio_pidstore/models.py:56
msgid "Deleted"
msgstr ""

2 changes: 1 addition & 1 deletion requirements-devel.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@
# waive the privileges and immunities granted to it by virtue of its status
# as an Intergovernmental Organization or submit itself to any jurisdiction.

-e git+git://github.com/inveniosoftware/invenio-db#egg=Invenio-DB
-e git+https://github.com/inveniosoftware/invenio-db#egg=invenio-db
-e git+https://github.com/inveniosoftware/datacite.git#egg=datacite
4 changes: 2 additions & 2 deletions run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
# as an Intergovernmental Organization or submit itself to any jurisdiction.


pydocstyle invenio_pidstore && \
isort -rc -c -df **/*.py && \
pydocstyle invenio_pidstore tests docs && \
isort -rc -c -df && \
check-manifest --ignore ".travis-*" && \
sphinx-build -qnNW docs docs/_build/html && \
python setup.py test
13 changes: 7 additions & 6 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@
# as an Intergovernmental Organization or submit itself to any jurisdiction.


[aliases]
test = pytest

[build_sphinx]
source-dir = docs/
build-dir = docs/_build
Expand All @@ -34,10 +31,14 @@ all_files = 1
[bdist_wheel]
universal = 1

[aliases]
test = pytest

[compile_catalog]
directory = invenio_pidstore/translations/

[extract_messages]
add-comments = NOTE
copyright_holder = CERN
msgid_bugs_address = info@inveniosoftware.org
mapping-file = babel.ini
Expand All @@ -47,9 +48,9 @@ output-file = invenio_pidstore/translations/messages.pot
input-file = invenio_pidstore/translations/messages.pot
output-dir = invenio_pidstore/translations/

[pydocstyle]
add_ignore = D401

[update_catalog]
input-file = invenio_pidstore/translations/messages.pot
output-dir = invenio_pidstore/translations/

[pydocstyle]
add_ignore = D401
16 changes: 7 additions & 9 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,10 @@
'coverage>=4.0',
'isort>=4.2.2',
'Flask-Menu>=0.5.1',
'invenio-access>=1.0.0a9',
'invenio-accounts>=1.0.0a9',
'invenio-admin>=1.0.0a3',
'invenio-records>=1.0.0a9',
'invenio-i18n>=1.0.0a4',
'invenio-access>=1.0.0a12',
'invenio-accounts>=1.0.0b3',
'invenio-admin>=1.0.0b1',
'invenio-records>=1.0.0b1',
'mock>=1.3.0',
'pydocstyle>=1.0.0',
'pytest-cache>=1.0',
Expand All @@ -59,13 +58,13 @@
'datacite>=0.1.0'
],
'mysql': [
'invenio-db[mysql]>=1.0.0b3',
'invenio-db[mysql]>=1.0.0b6',
],
'postgresql': [
'invenio-db[postgresql]>=1.0.0b3',
'invenio-db[postgresql]>=1.0.0b6',
],
'sqlite': [
'invenio-db>=1.0.0b3',
'invenio-db>=1.0.0b6',
],
'docs': [
'Sphinx>=1.5.1',
Expand Down Expand Up @@ -152,7 +151,6 @@
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy',
'Development Status :: 4 - Beta',
],
)
32 changes: 18 additions & 14 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,13 @@

import pytest
from flask import Flask
from invenio_db import InvenioDB, db
from sqlalchemy_utils.functions import create_database, database_exists, \
drop_database
from invenio_db import InvenioDB
from sqlalchemy_utils.functions import create_database, database_exists

from invenio_pidstore import InvenioPIDStore


@pytest.fixture()
@pytest.yield_fixture()
def app(request):
"""Flask application fixture."""
# Set temporary instance path for sqlite
Expand All @@ -55,16 +54,21 @@ def app(request):
)

with app.app_context():
if not database_exists(str(db.engine.url)):
create_database(str(db.engine.url))
db.drop_all()
db.create_all()
yield app

def teardown():
with app.app_context():
drop_database(str(db.engine.url))
shutil.rmtree(instance_path)
# Teardown instance path.
shutil.rmtree(instance_path)

request.addfinalizer(teardown)

return app
@pytest.yield_fixture()
def db(app):
"""Database fixture."""
from invenio_db import db as db_
if not database_exists(str(db_.engine.url)):
create_database(str(db_.engine.url))
db_.create_all()

yield db_

db_.session.remove()
db_.drop_all()
4 changes: 2 additions & 2 deletions tests/test_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def test_admin(app):
assert isinstance(submenu_items['Persistent Identifier'], menu.MenuView)


def test_filter_uuid(app):
def test_filter_uuid(app, db):
"""Test FilterUUID."""
with app.app_context():
myuuid = uuid.uuid4()
Expand All @@ -75,7 +75,7 @@ def test_filter_uuid(app):
assert query.count() == 1


def test_object_formatter(app):
def test_object_formatter(app, db):
"""Test FilterUUID."""
@app.route('/<id>')
def test_detail(id=None):
Expand Down
15 changes: 4 additions & 11 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,14 @@

import uuid

import pytest
from click.testing import CliRunner
from flask.cli import ScriptInfo
from invenio_db import db
from mock import patch
from sqlalchemy.exc import SQLAlchemyError

from invenio_pidstore.cli import pid as cmd
from invenio_pidstore.errors import PIDAlreadyExists, PIDDoesNotExistError, \
PIDInvalidAction, PIDObjectAlreadyAssigned
from invenio_pidstore.models import PersistentIdentifier, PIDStatus, Redirect
from invenio_pidstore.models import PersistentIdentifier, PIDStatus


def test_pid_creation(app):
def test_pid_creation(app, db):
"""Test pid creation."""
runner = CliRunner()
script_info = ScriptInfo(create_app=lambda info: app)
Expand Down Expand Up @@ -112,7 +106,7 @@ def test_pid_creation(app):
assert -1 == result.exit_code


def test_pid_assign(app):
def test_pid_assign(app, db):
"""Test pid object assignment."""
runner = CliRunner()
script_info = ScriptInfo(create_app=lambda info: app)
Expand All @@ -137,7 +131,6 @@ def test_pid_assign(app):
'-t', 'rec', '-i', str(rec_uuid)
], obj=script_info)
assert 0 == result.exit_code
pid_status = result.output
with app.app_context():
pid = PersistentIdentifier.get('doi', '10.1234/foo')
assert pid.has_object()
Expand Down Expand Up @@ -196,7 +189,7 @@ def test_pid_assign(app):
assert pid.get_assigned_object('oth') is None


def test_pid_unassign(app):
def test_pid_unassign(app, db):
"""Test pid object unassignment."""
runner = CliRunner()
script_info = ScriptInfo(create_app=lambda info: app)
Expand Down
6 changes: 2 additions & 4 deletions tests/test_ext.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@

from __future__ import absolute_import, print_function

import pkg_resources
from flask import Flask
from invenio_db import db
from mock import patch

from invenio_pidstore import InvenioPIDStore
Expand Down Expand Up @@ -69,12 +67,12 @@ def test_logger():
def test_invenio_records():
"""Test extension initialization."""
app = Flask('testapp')
with patch('invenio_pidstore.ext.pkg_resources') as obj:
with patch('invenio_pidstore.ext.pkg_resources'):
InvenioPIDStore(app)
assert app.config['PIDSTORE_OBJECT_ENDPOINTS']


def test_template_filters(app):
def test_template_filters(app, db):
"""Test the template filters."""
with app.app_context():
# Test the 'pid_exists' template filter
Expand Down
2 changes: 1 addition & 1 deletion tests/test_fetchers.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
from invenio_pidstore.minters import recid_minter


def test_recid_fetcher(app):
def test_recid_fetcher(app, db):
"""Test base provider."""
with app.app_context():
rec_uuid = uuid.uuid4()
Expand Down

0 comments on commit ce0e528

Please sign in to comment.