1
+ # -*- coding: utf-8 -*-
1
2
"""Tests for distutils.archive_util."""
2
3
import unittest
3
4
import os
@@ -32,6 +33,24 @@ class ArchiveUtilTestCase(support.TempdirManager,
32
33
33
34
@unittest .skipUnless (ZLIB_SUPPORT , 'Need zlib support to run' )
34
35
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 ):
35
54
# creating something to tar
36
55
tmpdir = self .mkdtemp ()
37
56
self .write_file ([tmpdir , 'file1' ], 'xxx' )
@@ -43,7 +62,7 @@ def test_make_tarball(self):
43
62
unittest .skipUnless (splitdrive (tmpdir )[0 ] == splitdrive (tmpdir2 )[0 ],
44
63
"Source and target should be on same drive" )
45
64
46
- base_name = os .path .join (tmpdir2 , 'archive' )
65
+ base_name = os .path .join (tmpdir2 , target_name )
47
66
48
67
# working with relative paths to avoid tar warnings
49
68
old_dir = os .getcwd ()
@@ -58,7 +77,7 @@ def test_make_tarball(self):
58
77
self .assertTrue (os .path .exists (tarball ))
59
78
60
79
# trying an uncompressed one
61
- base_name = os .path .join (tmpdir2 , 'archive' )
80
+ base_name = os .path .join (tmpdir2 , target_name )
62
81
old_dir = os .getcwd ()
63
82
os .chdir (tmpdir )
64
83
try :
0 commit comments