Skip to content

Commit 0cb209e

Browse files
committed
Simplify doctest
1 parent a5f6221 commit 0cb209e

File tree

1 file changed

+5
-21
lines changed

1 file changed

+5
-21
lines changed

setuptools/config/expand.py

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -220,30 +220,14 @@ def _find_module(
220220
"""Find the path to the module named ``module_name``,
221221
considering the ``package_dir`` in the build configuration and ``root_dir``.
222222
223-
>>> import pytest
224-
>>> if os.sep != "/": pytest.skip("require UNIX path separator")
225223
>>> tmp = getfixture('tmpdir')
226224
>>> _ = tmp.ensure("a/b/c.py")
227225
>>> _ = tmp.ensure("a/b/d/__init__.py")
228-
>>> cwd = tmp.as_cwd()
229-
>>> _ = cwd.__enter__()
230-
>>> _find_module("a.b.c", None, ".")
231-
'./a/b/c.py'
232-
>>> _find_module("a.b.d", None, ".")
233-
'./a/b/d/__init__.py'
234-
>>> _find_module("ab.c", {"ab": "a/b"}, "")
235-
'a/b/c.py'
236-
>>> _find_module("b.c", {"": "a"}, "")
237-
'a/b/c.py'
238-
>>> _find_module("a.b.c", None, tmp).replace(str(tmp), ".")
239-
'./a/b/c.py'
240-
>>> _find_module("f.c", {"f": "a/b"}, "")
241-
'a/b/c.py'
242-
>>> _find_module("f.g.c", {"f.g": "a/b"}, "")
243-
'a/b/c.py'
244-
>>> _find_module("f.g.h", {"": "1", "f": "2", "f.g": "3", "f.g.h": "a/b/d"}, "")
245-
'a/b/d/__init__.py'
246-
>>> _ = cwd.__exit__(None, None, None)
226+
>>> r = lambda x: x.replace(str(tmp), "tmp")
227+
>>> r(_find_module("a.b.c", None, tmp))
228+
'tmp/a/b/c.py'
229+
>>> r(_find_module("f.g.h", {"": "1", "f": "2", "f.g": "3", "f.g.h": "a/b/d"}, tmp))
230+
'tmp/a/b/d/__init__.py'
247231
"""
248232
path_start = find_package_path(module_name, package_dir or {}, root_dir)
249233
candidates = chain.from_iterable(

0 commit comments

Comments
 (0)