From 0cb209eeb1f8cea88ac0ebd9644d4892954b9ea4 Mon Sep 17 00:00:00 2001 From: Anderson Bravalheri Date: Thu, 30 May 2024 10:22:12 +0100 Subject: [PATCH] Simplify doctest --- setuptools/config/expand.py | 26 +++++--------------------- 1 file changed, 5 insertions(+), 21 deletions(-) diff --git a/setuptools/config/expand.py b/setuptools/config/expand.py index f077f3a613..22a6c6d70a 100644 --- a/setuptools/config/expand.py +++ b/setuptools/config/expand.py @@ -220,30 +220,14 @@ def _find_module( """Find the path to the module named ``module_name``, considering the ``package_dir`` in the build configuration and ``root_dir``. - >>> import pytest - >>> if os.sep != "/": pytest.skip("require UNIX path separator") >>> tmp = getfixture('tmpdir') >>> _ = tmp.ensure("a/b/c.py") >>> _ = tmp.ensure("a/b/d/__init__.py") - >>> cwd = tmp.as_cwd() - >>> _ = cwd.__enter__() - >>> _find_module("a.b.c", None, ".") - './a/b/c.py' - >>> _find_module("a.b.d", None, ".") - './a/b/d/__init__.py' - >>> _find_module("ab.c", {"ab": "a/b"}, "") - 'a/b/c.py' - >>> _find_module("b.c", {"": "a"}, "") - 'a/b/c.py' - >>> _find_module("a.b.c", None, tmp).replace(str(tmp), ".") - './a/b/c.py' - >>> _find_module("f.c", {"f": "a/b"}, "") - 'a/b/c.py' - >>> _find_module("f.g.c", {"f.g": "a/b"}, "") - 'a/b/c.py' - >>> _find_module("f.g.h", {"": "1", "f": "2", "f.g": "3", "f.g.h": "a/b/d"}, "") - 'a/b/d/__init__.py' - >>> _ = cwd.__exit__(None, None, None) + >>> r = lambda x: x.replace(str(tmp), "tmp") + >>> r(_find_module("a.b.c", None, tmp)) + 'tmp/a/b/c.py' + >>> r(_find_module("f.g.h", {"": "1", "f": "2", "f.g": "3", "f.g.h": "a/b/d"}, tmp)) + 'tmp/a/b/d/__init__.py' """ path_start = find_package_path(module_name, package_dir or {}, root_dir) candidates = chain.from_iterable(