Skip to content

Commit

Permalink
Backport pytest-runner fix from #633
Browse files Browse the repository at this point in the history
  • Loading branch information
hardbyte committed Jul 23, 2019
1 parent 07d1a18 commit ca7f1e6
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from os.path import isfile, join
import re
import logging
import sys
from setuptools import setup, find_packages

logging.basicConfig(level=logging.WARNING)
Expand Down Expand Up @@ -41,6 +42,14 @@

extras_require['test'] = tests_require

# Check for 'pytest-runner' only if setup.py was invoked with 'test'.
# This optimizes setup.py for cases when pytest-runner is not needed,
# using the approach that is suggested upstream.
#
# See https://pypi.org/project/pytest-runner/#conditional-requirement
needs_pytest = {"pytest", "test", "ptr"}.intersection(sys.argv)
pytest_runner = ["pytest-runner"] if needs_pytest else []


setup(
# Description
Expand Down Expand Up @@ -104,7 +113,7 @@
'typing;python_version<"3.5"',
'windows-curses;platform_system=="Windows"',
],
setup_requires=["pytest-runner"],
setup_requires=pytest_runner,
extras_require=extras_require,
tests_require=tests_require
)

0 comments on commit ca7f1e6

Please sign in to comment.