Skip to content

Commit 922b38d

Browse files
committed
Avoid path separator problem in doctest on windows
1 parent f4894f7 commit 922b38d

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

setuptools/dist.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -473,6 +473,12 @@ def _expand_patterns(cls, patterns: list[str]) -> Iterator[str]:
473473
['LICENSE']
474474
>>> list(Distribution._expand_patterns(['pyproject.toml', 'LIC*']))
475475
['pyproject.toml', 'LICENSE']
476+
>>> list(Distribution._expand_patterns(['setuptools/**/pyprojecttoml.py']))
477+
['setuptools/config/pyprojecttoml.py']
478+
>>> list(Distribution._expand_patterns(['../LICENSE']))
479+
Traceback (most recent call last):
480+
...
481+
setuptools.errors.InvalidConfigError: Pattern '../LICENSE' cannot contain '..'
476482
"""
477483
return (
478484
path.replace(os.sep, "/")
@@ -483,14 +489,6 @@ def _expand_patterns(cls, patterns: list[str]) -> Iterator[str]:
483489

484490
@staticmethod
485491
def _find_pattern(pattern: str) -> Iterator[str]:
486-
"""
487-
>>> list(Distribution._find_pattern("setuptools/**/pyprojecttoml.py"))
488-
['setuptools/config/pyprojecttoml.py']
489-
>>> list(Distribution._find_pattern("../LICENSE"))
490-
Traceback (most recent call last):
491-
...
492-
setuptools.errors.InvalidConfigError: Pattern '../LICENSE' cannot contain '..'
493-
"""
494492
if ".." in pattern: # XXX: Any other invalid character?
495493
raise InvalidConfigError(f"Pattern {pattern!r} cannot contain '..'")
496494
return iglob(pattern, recursive=True)

0 commit comments

Comments
 (0)