|
1 | 1 | from setuptools import setup, find_packages |
| 2 | +from setuptools.command.test import test as TestCommand |
2 | 3 | import sys |
3 | 4 |
|
4 | 5 | if sys.version_info[0] < 3: |
|
12 | 13 | # the numpy distutils extensions that are used by scikit-learn to recursively |
13 | 14 | # build the compiled extensions in sub-packages is based on the Python import |
14 | 15 | # machinery. |
15 | | -builtins.__GRAPHQL_SETUP__ = True |
| 16 | +if 'test' not in sys.argv: |
| 17 | + builtins.__GRAPHQL_SETUP__ = True |
16 | 18 |
|
17 | 19 | version = __import__('graphql').get_version() |
18 | 20 |
|
| 21 | +install_requires = [ |
| 22 | + 'six>=1.10.0', |
| 23 | + 'promise>=0.4.2' |
| 24 | +] |
| 25 | + |
| 26 | +tests_requires = [ |
| 27 | + 'pytest==3.0.2', |
| 28 | + 'pytest-django==2.9.1', |
| 29 | + 'pytest-cov==2.3.1', |
| 30 | + 'gevent==1.1rc1', |
| 31 | + 'six>=1.10.0', |
| 32 | + 'pytest-benchmark==3.0.0', |
| 33 | + 'pytest-mock==1.2', |
| 34 | +] |
| 35 | + |
| 36 | +class PyTest(TestCommand): |
| 37 | + def finalize_options(self): |
| 38 | + TestCommand.finalize_options(self) |
| 39 | + self.test_args = ['graphql', '-vrsx'] |
| 40 | + self.test_suite = True |
| 41 | + |
| 42 | + def run_tests(self): |
| 43 | + #import here, cause outside the eggs aren't loaded |
| 44 | + import pytest |
| 45 | + errno = pytest.main(self.test_args) |
| 46 | + sys.exit(errno) |
| 47 | + |
| 48 | + |
19 | 49 | setup( |
20 | 50 | name='graphql-core', |
21 | 51 | version=version, |
|
43 | 73 |
|
44 | 74 | keywords='api graphql protocol rest', |
45 | 75 | packages=find_packages(exclude=['tests', 'tests_py35']), |
46 | | - install_requires=[ |
47 | | - 'six>=1.10.0', |
48 | | - 'promise>=0.4.2' |
49 | | - ], |
50 | | - tests_require=[ |
51 | | - 'pytest==2.9.2', |
52 | | - 'pytest-benchmark', |
53 | | - 'pytest-cov', |
54 | | - 'gevent==1.1rc1', |
55 | | - 'six>=1.10.0', |
56 | | - 'pytest-mock' |
57 | | - ], |
| 76 | + install_requires=install_requires, |
| 77 | + tests_require=tests_requires, |
| 78 | + cmdclass = {'test': PyTest}, |
58 | 79 | extras_require={ |
59 | 80 | 'gevent': [ |
60 | 81 | 'gevent==1.1rc1' |
|
0 commit comments