2
1

0001-setup.py-require-pytest-runner-only-when-necessary.patch 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. From a6ff9745f56b776f244c2c412685f5c10ff0f09d Mon Sep 17 00:00:00 2001
  2. From: Bernd Kuhls <bernd.kuhls@t-online.de>
  3. Date: Fri, 24 Nov 2017 20:44:53 +0100
  4. Subject: [PATCH] setup.py: require pytest-runner only when necessary
  5. This optimizes setup.py for cases when pytest-runner is not needed,
  6. using the approach that is suggested upstream:
  7. https://pypi.python.org/pypi/pytest-runner#conditional-requirement
  8. Patch sent upstream: https://github.com/mwclient/mwclient/pull/180
  9. Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
  10. ---
  11. setup.py | 5 ++++-
  12. 1 file changed, 4 insertions(+), 1 deletion(-)
  13. diff --git a/setup.py b/setup.py
  14. index a32cbde..660d93b 100644
  15. --- a/setup.py
  16. +++ b/setup.py
  17. @@ -8,6 +8,9 @@ from setuptools import setup
  18. here = os.path.abspath(os.path.dirname(__file__))
  19. README = open(os.path.join(here, 'README.rst')).read()
  20. +needs_pytest = set(['pytest', 'test', 'ptr']).intersection(sys.argv)
  21. +pytest_runner = ['pytest-runner'] if needs_pytest else []
  22. +
  23. setup(name='mwclient',
  24. version='0.8.6', # Use bumpversion to update
  25. description='MediaWiki API client',
  26. @@ -27,7 +30,7 @@ setup(name='mwclient',
  27. license='MIT',
  28. packages=['mwclient'],
  29. install_requires=['requests_oauthlib', 'six'],
  30. - setup_requires=['pytest-runner'],
  31. + setup_requires=pytest_runner,
  32. tests_require=['pytest', 'pytest-pep8', 'pytest-cache', 'pytest-cov',
  33. 'responses>=0.3.0', 'responses!=0.6.0', 'mock'],
  34. zip_safe=True
  35. --
  36. 2.11.0