1+ # -*- coding: utf-8 -*-
12"""Tests for distutils.archive_util."""
23import unittest
34import 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