Skip to content

Commit

Permalink
global: renaming core to ext and pytest-runner
Browse files Browse the repository at this point in the history
* Updates package structure with pytest-runner and renames core to ext.

Signed-off-by: Jiri Kuncar <jiri.kuncar@cern.ch>
  • Loading branch information
jirikuncar committed Jun 29, 2016
1 parent 502447a commit 0c779ea
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 41 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,6 @@ docs/_build/

# PyBuilder
target/

# Tests
tests/test.db
2 changes: 1 addition & 1 deletion docs/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
API Docs
========

.. automodule:: invenio_db.core
.. automodule:: invenio_db.ext
:members:
:undoc-members:

Expand Down
2 changes: 1 addition & 1 deletion invenio_db/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class User(db.Model):

from __future__ import absolute_import, print_function

from .core import InvenioDB
from .ext import InvenioDB
from .shared import db
from .version import __version__

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@ pydocstyle invenio_db && \
isort -rc -c -df **/*.py && \
check-manifest --ignore ".travis-*" && \
sphinx-build -qnNW docs docs/_build/html && \
python setup.py test -a'-vv' && \
python setup.py test && \
sphinx-build -qnNW -b doctest docs docs/_build/doctest
5 changes: 4 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2015 CERN.
# Copyright (C) 2015, 2016 CERN.
#
# Invenio is free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public License as
Expand All @@ -23,6 +23,9 @@
# as an Intergovernmental Organization or submit itself to any jurisdiction.


[aliases]
test = pytest

[build_sphinx]
source-dir = docs/
build-dir = docs/_build
Expand Down
40 changes: 3 additions & 37 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,14 @@
import sys

from setuptools import find_packages, setup
from setuptools.command.test import test as TestCommand

readme = open('README.rst').read()
history = open('CHANGES.rst').read()

tests_require = [
'check-manifest>=0.25',
'coverage>=4.0',
'isort>=4.0.0',
'isort>=4.2.2',
'mock>=1.3.0',
'pydocstyle>=1.0.0',
'pytest-cache>=1.0',
Expand Down Expand Up @@ -67,6 +66,7 @@

setup_requires = [
'Babel>=1.3',
'pytest-runner>=2.6.2',
]

install_requires = [
Expand All @@ -79,39 +79,6 @@
packages = find_packages()


class PyTest(TestCommand):
"""PyTest Test."""

user_options = [('pytest-args=', 'a', "Arguments to pass to py.test")]

def initialize_options(self):
"""Init pytest."""
TestCommand.initialize_options(self)
self.pytest_args = []
try:
from ConfigParser import ConfigParser
except ImportError:
from configparser import ConfigParser
config = ConfigParser()
config.read('pytest.ini')
self.pytest_args = config.get('pytest', 'addopts').split(' ')

def finalize_options(self):
"""Finalize pytest."""
TestCommand.finalize_options(self)
if hasattr(self, '_test_args'):
self.test_suite = ''
else:
self.test_args = []
self.test_suite = True

def run_tests(self):
"""Run tests."""
# import here, cause outside the eggs aren't loaded
import pytest
errno = pytest.main(self.pytest_args)
sys.exit(errno)

# Get the version string. Cannot be done with import!
g = {}
with open(os.path.join('invenio_db', 'version.py'), 'rt') as fp:
Expand All @@ -123,7 +90,7 @@ def run_tests(self):
version=version,
description=__doc__,
long_description=readme + '\n\n' + history,
keywords='invenio',
keywords='invenio database',
license='GPLv2',
author='Invenio Collaboration',
author_email='info@inveniosoftware.org',
Expand Down Expand Up @@ -160,5 +127,4 @@ def run_tests(self):
'Programming Language :: Python :: 3.5',
'Development Status :: 1 - Planning',
],
cmdclass={'test': PyTest},
)

0 comments on commit 0c779ea

Please sign in to comment.