Issue #21280: Fixed a bug in shutil.make_archive() when create an archive of

current directory in current directory.
This commit is contained in:
Serhiy Storchaka 2014-11-28 00:49:50 +02:00
commit 0a99b2ab61
2 changed files with 17 additions and 2 deletions

View file

@ -1132,6 +1132,21 @@ class TestShutil(unittest.TestCase):
finally:
unregister_archive_format('xxx')
def test_make_tarfile_in_curdir(self):
# Issue #21280
root_dir = self.mkdtemp()
with support.change_cwd(root_dir):
self.assertEqual(make_archive('test', 'tar'), 'test.tar')
self.assertTrue(os.path.isfile('test.tar'))
@requires_zlib
def test_make_zipfile_in_curdir(self):
# Issue #21280
root_dir = self.mkdtemp()
with support.change_cwd(root_dir):
self.assertEqual(make_archive('test', 'zip'), 'test.zip')
self.assertTrue(os.path.isfile('test.zip'))
def test_register_archive_format(self):
self.assertRaises(TypeError, register_archive_format, 'xxx', 1)