summaryrefslogtreecommitdiff
path: root/ptr.py
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2019-02-14 08:40:18 -0500
committerJason R. Coombs <jaraco@jaraco.com>2019-02-14 08:43:57 -0500
commitb2202f5aee77d3a764154d89a56579da83232282 (patch)
tree419577b2484e4f5058f5a3bdea239a5d8874fb6f /ptr.py
parent1d0e60b043f7ea7ff421450ca5c3ce1c924e8ab3 (diff)
downloadpytest-runner-b2202f5aee77d3a764154d89a56579da83232282.tar.gz
Emit a warning when a future-unsupported setuptools version is detected. Ref #43.4.4
Diffstat (limited to 'ptr.py')
-rw-r--r--ptr.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/ptr.py b/ptr.py
index 8122e20..75fa993 100644
--- a/ptr.py
+++ b/ptr.py
@@ -8,6 +8,7 @@ import contextlib as _contextlib
import sys as _sys
import operator as _operator
import itertools as _itertools
+import warnings as _warnings
try:
# ensure that map has the same meaning on Python 2
@@ -153,11 +154,24 @@ class PyTest(orig.test):
results = list(map(dist.fetch_build_eggs, matching_extras))
return _itertools.chain.from_iterable(results)
+ @staticmethod
+ def _warn_old_setuptools():
+ msg = (
+ "pytest-runner will stop working on this version of setuptools; "
+ "please upgrade to setuptools 30.4 or later or pin to "
+ "pytest-runner < 5."
+ )
+ ver_str = pkg_resources.get_distribution('setuptools').version
+ ver = pkg_resources.parse_version(ver_str)
+ if ver < pkg_resources.parse_version('30.4'):
+ _warnings.warn(msg)
+
def run(self):
"""
Override run to ensure requirements are available in this session (but
don't install them anywhere).
"""
+ self._warn_old_setuptools()
dist = CustomizedDist()
for attr in 'allow_hosts index_url'.split():
setattr(dist, attr, getattr(self, attr))