Skip to content

Commit d05bcc2

Browse files
committed
Avoid path separator problem in doctest on windows
1 parent edbd1cf commit d05bcc2

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
@@ -484,6 +484,12 @@ def _expand_patterns(cls, patterns: list[str]) -> Iterator[str]:
484484
['LICENSE']
485485
>>> list(Distribution._expand_patterns(['pyproject.toml', 'LIC*']))
486486
['pyproject.toml', 'LICENSE']
487+
>>> list(Distribution._expand_patterns(['setuptools/**/pyprojecttoml.py']))
488+
['setuptools/config/pyprojecttoml.py']
489+
>>> list(Distribution._expand_patterns(['../LICENSE']))
490+
Traceback (most recent call last):
491+
...
492+
setuptools.errors.InvalidConfigError: Pattern '../LICENSE' cannot contain '..'
487493
"""
488494
return (
489495
path.replace(os.sep, "/")
@@ -494,14 +500,6 @@ def _expand_patterns(cls, patterns: list[str]) -> Iterator[str]:
494500

495501
@staticmethod
496502
def _find_pattern(pattern: str) -> Iterator[str]:
497-
"""
498-
>>> list(Distribution._find_pattern("setuptools/**/pyprojecttoml.py"))
499-
['setuptools/config/pyprojecttoml.py']
500-
>>> list(Distribution._find_pattern("../LICENSE"))
501-
Traceback (most recent call last):
502-
...
503-
setuptools.errors.InvalidConfigError: Pattern '../LICENSE' cannot contain '..'
504-
"""
505503
if ".." in pattern: # XXX: Any other invalid character?
506504
raise InvalidConfigError(f"Pattern {pattern!r} cannot contain '..'")
507505
return iglob(pattern, recursive=True)

0 commit comments

Comments
 (0)