summaryrefslogtreecommitdiff
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
parent1d0e60b043f7ea7ff421450ca5c3ce1c924e8ab3 (diff)
downloadpytest-runner-b2202f5aee77d3a764154d89a56579da83232282.tar.gz
Emit a warning when a future-unsupported setuptools version is detected. Ref #43.4.4
-rw-r--r--CHANGES.rst7
-rw-r--r--ptr.py14
2 files changed, 21 insertions, 0 deletions
diff --git a/CHANGES.rst b/CHANGES.rst
index 02d5618..0ae8d37 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -1,3 +1,10 @@
+4.4
+===
+
+* #43: Detect condition where declarative config will cause
+ errors and emit a UserWarning with guidance on necessary
+ actions.
+
4.3.1
=====
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))