diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2018-03-03 12:19:29 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-03 12:19:29 (GMT) |
commit | fbdd075c64a5229dfa26632cf1b2cf2361dc5003 (patch) | |
tree | a959f2fc206302c629b217ca811f305b7f5060be /Lib/test/test_shutil.py | |
parent | 10fb1bf7766e7eb9500d328ddd1035e3f823fb57 (diff) | |
download | cpython-fbdd075c64a5229dfa26632cf1b2cf2361dc5003.zip cpython-fbdd075c64a5229dfa26632cf1b2cf2361dc5003.tar.gz cpython-fbdd075c64a5229dfa26632cf1b2cf2361dc5003.tar.bz2 |
[3.6] bpo-32964: Reuse a testing implementation of the path protocol in tests. (GH-5930). (GH-5958)
(cherry picked from commit b21d155f57d284aecf9092a9bd24258293965c2f)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Diffstat (limited to 'Lib/test/test_shutil.py')
-rw-r--r-- | Lib/test/test_shutil.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/Lib/test/test_shutil.py b/Lib/test/test_shutil.py index 95717a4..588e7d2 100644 --- a/Lib/test/test_shutil.py +++ b/Lib/test/test_shutil.py @@ -10,6 +10,7 @@ import os import os.path import errno import functools +import pathlib import subprocess from contextlib import ExitStack from shutil import (make_archive, @@ -21,9 +22,10 @@ from shutil import (make_archive, import tarfile import zipfile import warnings +import pathlib from test import support -from test.support import TESTFN, check_warnings, captured_stdout +from test.support import TESTFN, FakePath TESTFN2 = TESTFN + "2" @@ -1231,6 +1233,11 @@ class TestShutil(unittest.TestCase): self.assertNotIn('xxx', formats) def check_unpack_archive(self, format): + self.check_unpack_archive_with_converter(format, lambda path: path) + self.check_unpack_archive_with_converter(format, pathlib.Path) + self.check_unpack_archive_with_converter(format, FakePath) + + def check_unpack_archive_with_converter(self, format, converter): root_dir, base_dir = self._create_files() expected = rlistdir(root_dir) expected.remove('outer') |