Repository: zopefoundation/zc.recipe.testrunner (language: python)

Issue:
Broken tests due to new setuptools release
A new release of `setuptools` broke the tests for this package, see https://github.com/zopefoundation/zc.recipe.testrunner/actions/runs/4844199658/jobs/8632330821

They should be fixable like the ones of `zc.zope3recipes`, see https://github.com/zopefoundation/zc.zope3recipes/commit/99c0f4867cdd306698bff95822b0454671197117


Discussion / hints:

Fix patch:
diff --git a/.meta.toml b/.meta.toml
index 828557d..15e9fd6 100644
--- a/.meta.toml
+++ b/.meta.toml
@@ -2,7 +2,7 @@
 # https://github.com/zopefoundation/meta/tree/master/config/buildout-recipe
 [meta]
 template = "buildout-recipe"
-commit-id = "552fe384"
+commit-id = "fe63cb4c"
 
 [python]
 with-pypy = true
@@ -12,7 +12,7 @@ with-future-python = false
 with-macos = false
 
 [coverage]
-fail-under = 96
+fail-under = 100
 
 [tox]
 use-flake8 = true
diff --git a/CHANGES.rst b/CHANGES.rst
index cc96686..a21857a 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -5,7 +5,7 @@ Change History
 3.1 (unreleased)
 ================
 
-- Nothing changed yet.
+- Fix tests to run successfully against newer ``setuptools`` versions.
 
 
 3.0 (2023-02-08)
diff --git a/setup.cfg b/setup.cfg
index 7e2dc0f..5b08ef0 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -17,7 +17,7 @@ ignore =
 force_single_line = True
 combine_as_imports = True
 sections = FUTURE,STDLIB,THIRDPARTY,ZOPE,FIRSTPARTY,LOCALFOLDER
-known_third_party = six, docutils, pkg_resources, pytz
+known_third_party = docutils, pkg_resources, pytz
 known_zope =
 known_first_party =
 default_section = ZOPE
diff --git a/tox.ini b/tox.ini
index fd777b7..cbe7345 100644
--- a/tox.ini
+++ b/tox.ini
@@ -58,4 +58,4 @@ commands =
     coverage run -m zope.testrunner --test-path=src {posargs:-vc}
     coverage combine
     coverage html
-    coverage report -m --fail-under=96
+    coverage report -m --fail-under=100


Test patch:
diff --git a/src/zc/recipe/testrunner/__init__.py b/src/zc/recipe/testrunner/__init__.py
index c4341d2..b6b2de2 100644
--- a/src/zc/recipe/testrunner/__init__.py
+++ b/src/zc/recipe/testrunner/__init__.py
@@ -118,7 +118,7 @@ def install(self):
 
 def _relativize(base, path):
     base += os.path.sep
-    if sys.platform == 'win32':
+    if sys.platform == 'win32':  # pragma: no cover
         # windoze paths are case insensitive, but startswith is not
         base = base.lower()
         path = path.lower()
@@ -126,5 +126,5 @@ def _relativize(base, path):
     if path.startswith(base):
         path = 'join(base, %r)' % path[len(base):]
     else:
-        path = repr(path)
+        path = repr(path)  # pragma: no cover
     return path
diff --git a/src/zc/recipe/testrunner/tests.py b/src/zc/recipe/testrunner/tests.py
index 47678dc..8067874 100644
--- a/src/zc/recipe/testrunner/tests.py
+++ b/src/zc/recipe/testrunner/tests.py
@@ -174,6 +174,24 @@ def setUp(test):
     (re.compile(r'.*SetuptoolsDeprecationWarning.*\n'), ''),
     # Ignore warnings for Python <= 3.10:
     (re.compile(r'.*warnings.warn\(\n'), ''),
+    # Ignore Setuptools warnings:
+    (lambda s: s.replace('*'*80, '')),
+    (lambda s: s.replace('!!\n', '')),
+    (lambda s: s.replace(
+        'Please avoid running ``setup.py`` and ``easy_install``.', '')),
+    (lambda s: s.replace(
+        'Please avoid running ``setup.py`` directly.', '')),
+    (lambda s: s.replace(
+        'Instead, use pypa/build, pypa/installer, pypa/build or', '')),
+    (lambda s: s.replace('other standards-based tools.', '')),
+    (lambda s: s.replace(
+        'See https://github.com/pypa/setuptools/issues/917 for details.', '')),
+    (lambda s: s.replace(
+        'See https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html'
+        ' for details.', '')),
+    (lambda s: s.replace('easy_install.initialize_options(self)', '')),
+    (lambda s: s.replace('self.initialize_options()', '')),
+    (lambda s: s.strip()),  # clean up leftovers from replacements
 ])