From: Colin Watson Date: Tue, 22 Sep 2026 16:30:46 +0100 Subject: Drop pkg_resources Bug-Debian: https://bugs.debian.org/1147770 Last-Update: 2026-09-22 --- flufl/password/tests/test_documentation.py | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/flufl/password/tests/test_documentation.py b/flufl/password/tests/test_documentation.py index cf5bc96..08612f1 100644 --- a/flufl/password/tests/test_documentation.py +++ b/flufl/password/tests/test_documentation.py @@ -25,13 +25,10 @@ __all__ = [ ] -import os -import atexit import doctest +import importlib.util import unittest - -from pkg_resources import ( - resource_filename, resource_exists, resource_listdir, cleanup_resources) +from pathlib import Path COMMASPACE = ', ' @@ -84,18 +81,19 @@ def setup(testobj): def additional_tests(): "Run the doc tests (README.rst and docs/*, if any exist)" - doctest_files = [ - os.path.abspath(resource_filename('flufl.password', 'README.rst'))] - if resource_exists('flufl.password', 'docs'): - for name in resource_listdir('flufl.password', 'docs'): - if name.endswith('.rst'): - doctest_files.append( - os.path.abspath( - resource_filename('flufl.password', 'docs/%s' % name))) + doctest_files = [] + spec = importlib.util.find_spec('flufl.password') + if not spec or not spec.submodule_search_locations: + return doctest_files + path = Path(next(iter(spec.submodule_search_locations))) + doctest_files = [str((path / 'README.rst').resolve())] + docs_path = path / 'docs' + for path in docs_path.iterdir(): + if path.name.endswith('.rst'): + doctest_files.append(str(path.resolve())) kwargs = dict(module_relative=False, optionflags=DOCTEST_FLAGS, setUp=setup, ) - atexit.register(cleanup_resources) return unittest.TestSuite(( doctest.DocFileSuite(*doctest_files, **kwargs)))