Skip to content
This repository was archived by the owner on Jul 22, 2019. It is now read-only.

tests: pep257 to pydocstyle #16

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# This file is part of Flask-AppFactory
# Copyright (C) 2015 CERN.
# Copyright (C) 2015, 2016 CERN.
#
# Flask-AppFactory is free software; you can redistribute it and/or
# modify it under the terms of the Revised BSD License; see LICENSE
Expand All @@ -24,13 +24,13 @@ cache:

install:
# Install test dependencies
- "travis_retry pip install coveralls pep257 Sphinx twine wheel"
- "travis_retry pip install coveralls pydocstyle Sphinx twine wheel"
- "travis_retry pip install pytest pytest-pep8 pytest-cov pytest-cache"
- "travis_retry pip install -r requirements.${REQUIREMENTS}.txt"
- "travis_retry pip install -e ."
- "travis_retry pip install -e .[docs,tests]"

script:
- pep257 flask_appfactory
- pydocstyle flask_appfactory
- "sphinx-build -qnNW docs docs/_build/html"
- python setup.py test
- "sphinx-build -qnNW -b doctest docs docs/_build/doctest"
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ RUN pip install Flask \
coveralls \
ipython \
itsdangerous \
pep257 \
pydocstyle \
pytest \
pytest-cache \
pytest-cov \
Expand Down
3 changes: 1 addition & 2 deletions flask_appfactory/cli.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
#
# This file is part of Flask-AppFactory
# Copyright (C) 2015 CERN.
# Copyright (C) 2015, 2016 CERN.
#
# Flask-AppFactory is free software; you can redistribute it and/or
# modify it under the terms of the Revised BSD License; see LICENSE
Expand All @@ -19,7 +19,6 @@


class CLIDiscoveryRegistry(ModuleAutoDiscoveryRegistry):

"""Discover CLI modules and register them on a command collection.

Searches for a variable ``commands`` in a module ``cli`` in each package.
Expand Down
3 changes: 1 addition & 2 deletions flask_appfactory/ext/jinja2.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
#
# This file is part of Flask-AppFactory
# Copyright (C) 2015 CERN.
# Copyright (C) 2015, 2016 CERN.
#
# Flask-AppFactory is free software; you can redistribute it and/or
# modify it under the terms of the Revised BSD License; see LICENSE
Expand Down Expand Up @@ -43,7 +43,6 @@ def blueprint_is_module(blueprint):


class OrderAwareDispatchingJinjaLoader(DispatchingJinjaLoader):

"""Order aware dispatching Jinja loader.

Customization of default Flask Jinja2 template loader. By default the
Expand Down
4 changes: 2 additions & 2 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# This file is part of Flask-AppFactory
# Copyright (C) 2015 CERN.
# Copyright (C) 2015, 2016 CERN.
#
# Flask-AppFactory is free software; you can redistribute it and/or
# modify it under the terms of the Revised BSD License; see LICENSE
# file for more details.

[pytest]
addopts = --clearcache --pep8 --ignore=docs --cov=flask_appfactory --cov-report=term-missing tests flask_appfactory
addopts = --pep8 --ignore=docs --cov=flask_appfactory --cov-report=term-missing tests flask_appfactory
2 changes: 1 addition & 1 deletion run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# modify it under the terms of the Revised BSD License; see LICENSE
# file for more details.

pep257 flask_appfactory && \
pydocstyle flask_appfactory && \
sphinx-build -qnNW docs docs/_build/html && \
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,5 +1,5 @@
# This file is part of Flask-AppFactory
# Copyright (C) 2015 CERN.
# Copyright (C) 2015, 2016 CERN.
#
# Flask-AppFactory is free software; you can redistribute it and/or
# modify it under the terms of the Revised BSD License; see LICENSE
Expand All @@ -12,3 +12,6 @@ universal=1
source-dir = docs/
build-dir = docs/_build
all_files = 1

[aliases]
test = pytest
46 changes: 6 additions & 40 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
#
# This file is part of Flask-AppFactory
# Copyright (C) 2015 CERN.
# Copyright (C) 2015, 2016 CERN.
#
# Flask-AppFactory is free software; you can redistribute it and/or
# modify it under the terms of the Revised BSD License; see LICENSE
Expand All @@ -14,42 +14,6 @@
import sys

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


class PyTest(TestCommand):

"""Integration of PyTest with setuptools."""

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

def initialize_options(self):
"""Initialize options."""
TestCommand.initialize_options(self)
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 options."""
TestCommand.finalize_options(self)
self.test_args = []
self.test_suite = True

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

# Get the version string. Cannot be done with import!
with open(os.path.join('flask_appfactory', 'version.py'), 'rt') as f:
version = re.search(
Expand All @@ -61,8 +25,9 @@ def run_tests(self):
'pytest-cache>=1.0',
'pytest-cov>=1.8.0',
'pytest-pep8>=1.0.6',
'pytest>=2.6.1',
'coverage<4.0a1',
'pytest-runner>=2.7.0',
'pytest>=2.8.0',
'coverage>=4.0',
]

setup(
Expand All @@ -85,8 +50,9 @@ def run_tests(self):
],
extras_require={
'celery': ['Flask-CeleryExt>=0.1.0'],
'docs': ['Sphinx'],
'tests': tests_require,
},
cmdclass={'test': PyTest},
classifiers=[
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.6',
Expand Down