git: 4e07271f7204 - main - devel/py-pathlib2: Improve how tests are handled, and other small improvements
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 10 Sep 2026 20:06:43 UTC
The branch main has been updated by yuri:
URL: https://cgit.FreeBSD.org/ports/commit/?id=4e07271f7204bc60d2bea592dcbedbbf90237d54
commit 4e07271f7204bc60d2bea592dcbedbbf90237d54
Author: Yuri Victorovich <yuri@FreeBSD.org>
AuthorDate: 2026-09-10 16:09:02 +0000
Commit: Yuri Victorovich <yuri@FreeBSD.org>
CommitDate: 2026-09-10 19:58:22 +0000
devel/py-pathlib2: Improve how tests are handled, and other small improvements
---
devel/py-pathlib2/Makefile | 14 +++++----
devel/py-pathlib2/distinfo | 2 +-
.../files/patch-tests_test__pathlib2.py | 33 ++++++++++++++++++++++
3 files changed, 42 insertions(+), 7 deletions(-)
diff --git a/devel/py-pathlib2/Makefile b/devel/py-pathlib2/Makefile
index 0021faff5c87..c84a6d567cb2 100644
--- a/devel/py-pathlib2/Makefile
+++ b/devel/py-pathlib2/Makefile
@@ -14,13 +14,15 @@ LICENSE_FILE= ${WRKSRC}/LICENSE.rst
RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}six>=0:devel/py-six@${PY_FLAVOR}
-USES= python
-USE_PYTHON= distutils autoplist
+USES= python dos2unix
+USE_PYTHON= distutils autoplist pytest
NO_ARCH= yes
-do-test:
- @(cd ${WRKSRC} && \
- ${PYTHON_CMD} test_pathlib2.py && \
- ${PYTHON_CMD} test_pathlib2_with_py2_unicode_literals.py)
+DOS2UNIX_FILES= tests/test_pathlib2.py
+
+TEST_ENV= ${MAKE_ENV} PYTHONPATH=${STAGEDIR}${PYTHONPREFIX_SITELIBDIR}
+TEST_WRKDIR= ${WRKSRC}/tests
+
+# tests as of 2.3.7: 313 passed, 115 skipped in 0.65s
.include <bsd.port.mk>
diff --git a/devel/py-pathlib2/distinfo b/devel/py-pathlib2/distinfo
index e55676d2b4b6..4391a82fbe92 100644
--- a/devel/py-pathlib2/distinfo
+++ b/devel/py-pathlib2/distinfo
@@ -1,3 +1,3 @@
-TIMESTAMP = 1651422795
+TIMESTAMP = 1789056455
SHA256 (pathlib2-2.3.7.tar.gz) = 7a4329d67beff9a712e1d3ae147e4e3e108b0bfd284ffdea03a635126c76b3c0
SIZE (pathlib2-2.3.7.tar.gz) = 38804
diff --git a/devel/py-pathlib2/files/patch-tests_test__pathlib2.py b/devel/py-pathlib2/files/patch-tests_test__pathlib2.py
new file mode 100644
index 000000000000..34d444f4293d
--- /dev/null
+++ b/devel/py-pathlib2/files/patch-tests_test__pathlib2.py
@@ -0,0 +1,33 @@
+-- Fix tests for Python 3.12 where test.support attributes were moved to sub-modules.
+-- test.support.TESTFN, rmtree, can_symlink, skip_unless_symlink, EnvironmentVarGuard
+-- were moved to test.support.os_helper; import_module moved to test.support.import_helper.
+--- tests/test_pathlib2.py.orig 2026-09-10 09:22:20 UTC
++++ tests/test_pathlib2.py
+@@ -46,6 +46,27 @@ except ImportError:
+ except ImportError:
+ from test import test_support as support # type: ignore
+
++# Python 3.12 compatibility: many test.support attributes were moved to sub-modules
++try:
++ from test.support import os_helper as _os_helper
++ from test.support import import_helper as _import_helper
++ for _attr, _src in [
++ ("TESTFN", None),
++ ("rmtree", _os_helper),
++ ("can_symlink", _os_helper),
++ ("skip_unless_symlink", _os_helper),
++ ("EnvironmentVarGuard", _os_helper),
++ ("import_module", _import_helper),
++ ]:
++ if not hasattr(support, _attr):
++ if _src is None:
++ setattr(support, _attr, "test_pathlib2_tmp")
++ else:
++ setattr(support, _attr, getattr(_src, _attr))
++except ImportError:
++ if not hasattr(support, "TESTFN"):
++ support.TESTFN = "test_pathlib2_tmp"
++
+ android_not_root = getattr(support, "android_not_root", False)
+
+ fs_ascii_encoding_only = six.unichr(0x0100).encode(