From 256c84a9a535e62a04942d2e96f6972ea269bd78 Mon Sep 17 00:00:00 2001 From: Syrus Akbary Date: Tue, 7 Feb 2017 21:54:50 -0800 Subject: [PATCH] Added test extra requirements --- .travis.yml | 3 +-- README.md | 10 ++++++++-- README.rst | 10 ++++++++-- setup.py | 20 +++++++++++++------- 4 files changed, 30 insertions(+), 13 deletions(-) diff --git a/.travis.yml b/.travis.yml index 541c0c0f..89b17c0c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,8 +22,7 @@ before_install: install: - | if [ "$TEST_TYPE" = build ]; then - pip install pytest pytest-cov pytest-benchmark coveralls six pytz iso8601 - pip install -e . + pip install -e .[test] python setup.py develop elif [ "$TEST_TYPE" = lint ]; then pip install flake8 diff --git a/README.md b/README.md index edd50bc9..2c77930b 100644 --- a/README.md +++ b/README.md @@ -75,13 +75,19 @@ If you want to learn even more, you can also check the following [examples](exam After cloning this repo, ensure dependencies are installed by running: ```sh -python setup.py install +pip install .[test] ``` After developing, the full test suite can be evaluated by running: ```sh -python setup.py test # Use --pytest-args="-v -s" for verbose mode +py.test graphene --cov=graphene --benchmark-skip # Use -v -s for verbose mode +``` + +You can also run the benchmarks with: + +```sh +py.test graphene --benchmark-only ``` diff --git a/README.rst b/README.rst index 0a866b48..e186a31d 100644 --- a/README.rst +++ b/README.rst @@ -89,13 +89,19 @@ After cloning this repo, ensure dependencies are installed by running: .. code:: sh - python setup.py install + pip install .[test] After developing, the full test suite can be evaluated by running: .. code:: sh - python setup.py test # Use --pytest-args="-v -s" for verbose mode + py.test graphene --cov=graphene --benchmark-skip # Use -v -s for verbose mode + +You can also run the benchmarks with: + +.. code:: sh + + py.test graphene --benchmark-only Documentation ~~~~~~~~~~~~~ diff --git a/setup.py b/setup.py index 4c336451..20742eef 100644 --- a/setup.py +++ b/setup.py @@ -37,6 +37,17 @@ class PyTest(TestCommand): errno = pytest.main(self.pytest_args) sys.exit(errno) +tests_require = [ + 'pytest>=2.7.2', + 'pytest-benchmark', + 'pytest-cov', + 'coveralls', + 'six', + 'mock', + 'pytz', + 'iso8601', +] + setup( name='graphene', version=version, @@ -74,14 +85,9 @@ setup( 'graphql-relay>=0.4.5', 'promise>=1.0.1', ], - tests_require=[ - 'pytest>=2.7.2', - 'pytest-benchmark', - 'mock', - 'pytz', - 'iso8601', - ], + tests_require=tests_require, extras_require={ + 'test': tests_require, 'django': [ 'graphene-django', ],