11# -*- coding: utf-8 -*-
22#
33# This file is part of Flask-AppFactory
4- # Copyright (C) 2015 CERN.
4+ # Copyright (C) 2015, 2016 CERN.
55#
66# Flask-AppFactory is free software; you can redistribute it and/or
77# modify it under the terms of the Revised BSD License; see LICENSE
1414import sys
1515
1616from setuptools import setup
17- from setuptools .command .test import test as TestCommand
18-
19-
20- class PyTest (TestCommand ):
21-
22- """Integration of PyTest with setuptools."""
23-
24- user_options = [('pytest-args=' , 'a' , 'Arguments to pass to py.test' )]
25-
26- def initialize_options (self ):
27- """Initialize options."""
28- TestCommand .initialize_options (self )
29- try :
30- from ConfigParser import ConfigParser
31- except ImportError :
32- from configparser import ConfigParser
33- config = ConfigParser ()
34- config .read ("pytest.ini" )
35- self .pytest_args = config .get ("pytest" , "addopts" ).split (" " )
36-
37- def finalize_options (self ):
38- """Finalize options."""
39- TestCommand .finalize_options (self )
40- self .test_args = []
41- self .test_suite = True
42-
43- def run_tests (self ):
44- """Run tests."""
45- # import here, cause outside the eggs aren't loaded
46- import pytest
47- import _pytest .config
48- pm = _pytest .config .get_plugin_manager ()
49- pm .consider_setuptools_entrypoints ()
50- errno = pytest .main (self .pytest_args )
51- sys .exit (errno )
52-
5317# Get the version string. Cannot be done with import!
5418with open (os .path .join ('flask_appfactory' , 'version.py' ), 'rt' ) as f :
5519 version = re .search (
@@ -61,8 +25,9 @@ def run_tests(self):
6125 'pytest-cache>=1.0' ,
6226 'pytest-cov>=1.8.0' ,
6327 'pytest-pep8>=1.0.6' ,
64- 'pytest>=2.6.1' ,
65- 'coverage<4.0a1' ,
28+ 'pytest-runner>=2.7.0' ,
29+ 'pytest>=2.8.0' ,
30+ 'coverage>=4.0' ,
6631]
6732
6833setup (
@@ -85,8 +50,9 @@ def run_tests(self):
8550 ],
8651 extras_require = {
8752 'celery' : ['Flask-CeleryExt>=0.1.0' ],
53+ 'docs' : ['Sphinx' ],
54+ 'tests' : tests_require ,
8855 },
89- cmdclass = {'test' : PyTest },
9056 classifiers = [
9157 'Programming Language :: Python :: 2' ,
9258 'Programming Language :: Python :: 2.6' ,
0 commit comments