Skip to content

Commit e7437a7

Browse files
committed
Ported some test cases from 2.7 for #11638
1 parent 1e66f56 commit e7437a7

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

Lib/distutils/tests/test_archive_util.py

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# -*- coding: utf-8 -*-
12
"""Tests for distutils.archive_util."""
23
import unittest
34
import os
@@ -32,6 +33,24 @@ class ArchiveUtilTestCase(support.TempdirManager,
3233

3334
@unittest.skipUnless(ZLIB_SUPPORT, 'Need zlib support to run')
3435
def test_make_tarball(self):
36+
self._make_tarball('archive')
37+
38+
@unittest.skipUnless(ZLIB_SUPPORT, 'Need zlib support to run')
39+
def test_make_tarball_latin1(self):
40+
"""
41+
Mirror test_make_tarball, except filename contains latin characters.
42+
"""
43+
self._make_tarball('årchiv') # note this isn't a real word
44+
45+
@unittest.skipUnless(ZLIB_SUPPORT, 'Need zlib support to run')
46+
def test_make_tarball_extended(self):
47+
"""
48+
Mirror test_make_tarball, except filename contains extended
49+
characters outside the latin charset.
50+
"""
51+
self._make_tarball('のアーカイブ') # japanese for archive
52+
53+
def _make_tarball(self, target_name):
3554
# creating something to tar
3655
tmpdir = self.mkdtemp()
3756
self.write_file([tmpdir, 'file1'], 'xxx')
@@ -43,7 +62,7 @@ def test_make_tarball(self):
4362
unittest.skipUnless(splitdrive(tmpdir)[0] == splitdrive(tmpdir2)[0],
4463
"Source and target should be on same drive")
4564

46-
base_name = os.path.join(tmpdir2, 'archive')
65+
base_name = os.path.join(tmpdir2, target_name)
4766

4867
# working with relative paths to avoid tar warnings
4968
old_dir = os.getcwd()
@@ -58,7 +77,7 @@ def test_make_tarball(self):
5877
self.assertTrue(os.path.exists(tarball))
5978

6079
# trying an uncompressed one
61-
base_name = os.path.join(tmpdir2, 'archive')
80+
base_name = os.path.join(tmpdir2, target_name)
6281
old_dir = os.getcwd()
6382
os.chdir(tmpdir)
6483
try:

0 commit comments

Comments
 (0)