Don't test for path-like bytes paths on Windows

This commit is contained in:
Brett Cannon 2016-08-27 09:42:40 -07:00
parent 1b6c6da85d
commit 3ce2fd484b
1 changed files with 7 additions and 2 deletions

View File

@ -2841,14 +2841,17 @@ def __fspath__(self):
return self.path
str_filename = support.TESTFN
bytes_filename = support.TESTFN.encode('ascii')
if os.name == 'nt':
bytes_fspath = bytes_filename = None
else:
bytes_filename = support.TESTFN.encode('ascii')
bytes_fspath = PathLike(bytes_filename)
fd = os.open(PathLike(str_filename), os.O_WRONLY|os.O_CREAT)
self.addCleanup(os.close, fd)
self.addCleanup(support.unlink, support.TESTFN)
int_fspath = PathLike(fd)
str_fspath = PathLike(str_filename)
bytes_fspath = PathLike(bytes_filename)
for name, allow_fd, extra_args, cleanup_fn in self.functions:
with self.subTest(name=name):
@ -2859,6 +2862,8 @@ def __fspath__(self):
for path in (str_filename, bytes_filename, str_fspath,
bytes_fspath):
if path is None:
continue
with self.subTest(name=name, path=path):
result = fn(path, *extra_args)
if cleanup_fn is not None: