summaryrefslogtreecommitdiff
path: root/setup.py
diff options
context:
space:
mode:
authorEnji Cooper <yaneurabeya@gmail.com>2019-11-14 13:35:15 -0800
committerClaudiu Popa <pcmanticore@gmail.com>2019-11-16 21:21:15 +0100
commit39c6cdd61da9d398e47425579478da39e84b2e3a (patch)
tree1a56f5d1fc8781a30e13df039a76014438485c24 /setup.py
parent657fa7638b2884c622e61f3b06f8dba972550fb2 (diff)
downloadastroid-git-39c6cdd61da9d398e47425579478da39e84b2e3a.tar.gz
Make installing pytest-runner contingent on running tests
This monkeypatches several changes from [PyCQA/mccabe](https://github.com/PyCQA/mccabe/blob/master/setup.py) over to the pylint repo, since the pattern was equivalent between the two projects. Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
Diffstat (limited to 'setup.py')
-rw-r--r--setup.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/setup.py b/setup.py
index eb3d9102..ad2891c1 100644
--- a/setup.py
+++ b/setup.py
@@ -12,6 +12,7 @@
# pylint: disable=W0404,W0622,W0613
"""Setup script for astroid."""
import os
+import sys
from setuptools import find_packages, setup
from setuptools.command import easy_install # pylint: disable=unused-import
from setuptools.command import install_lib # pylint: disable=unused-import
@@ -27,6 +28,9 @@ with open(os.path.join(astroid_dir, "README.rst")) as fobj:
long_description = fobj.read()
+needs_pytest = set(['pytest', 'test', 'ptr']).intersection(sys.argv)
+pytest_runner = ['pytest-runner'] if needs_pytest else []
+
def install():
return setup(
name="astroid",
@@ -42,7 +46,7 @@ def install():
install_requires=install_requires,
extras_require=extras_require,
packages=find_packages() + ["astroid.brain"],
- setup_requires=["pytest-runner"],
+ setup_requires=pytest_runner,
test_suite="test",
tests_require=["pytest"],
)