Skip to content

Commit

Permalink
setup.py: require pytest-runner only when necessary
Browse files Browse the repository at this point in the history
This optimizes setup.py for cases when pytest-runner is not needed,
using the approach that is suggested upstream:

https://pypi.python.org/pypi/pytest-runner#conditional-requirement
  • Loading branch information
bkuhls authored and danmichaelo committed Nov 26, 2017
1 parent cd86bf3 commit 60d4b93
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion setup.py
Expand Up @@ -8,6 +8,9 @@
here = os.path.abspath(os.path.dirname(__file__))
README = open(os.path.join(here, 'README.rst')).read()

needs_pytest = set(['pytest', 'test', 'ptr']).intersection(sys.argv)
pytest_runner = ['pytest-runner'] if needs_pytest else []

setup(name='mwclient',
version='0.8.6', # Use bumpversion to update
description='MediaWiki API client',
Expand All @@ -27,7 +30,7 @@
license='MIT',
packages=['mwclient'],
install_requires=['requests_oauthlib', 'six'],
setup_requires=['pytest-runner'],
setup_requires=pytest_runner,
tests_require=['pytest', 'pytest-pep8', 'pytest-cache', 'pytest-cov',
'responses>=0.3.0', 'responses!=0.6.0', 'mock'],
zip_safe=True
Expand Down

0 comments on commit 60d4b93

Please sign in to comment.