codekingpro/portable-devtools
114k
1import io2import tarfile3 4import pytest5 6from setuptools import archive_util7 8 9@pytest.fixture10def tarfile_with_unicode(tmpdir):11 """12 Create a tarfile containing only a file whose name is13 a zero byte file called testimäge.png.14 """15 tarobj = io.BytesIO()16 17 with tarfile.open(fileobj=tarobj, mode="w:gz") as tgz:18 data = b""19 20 filename = "testimäge.png"21 22 t = tarfile.TarInfo(filename)23 t.size = len(data)24 25 tgz.addfile(t, io.BytesIO(data))26 27 target = tmpdir / 'unicode-pkg-1.0.tar.gz'28 with open(str(target), mode='wb') as tf:29 tf.write(tarobj.getvalue())30 return str(target)31 32 33@pytest.mark.xfail(reason="#710 and #712")34def test_unicode_files(tarfile_with_unicode, tmpdir):35 target = tmpdir / 'out'36 archive_util.unpack_archive(tarfile_with_unicode, str(target))37 