Message171090
Here's a test case that re-creates this issue.
I chose to use mocks instead of sample files from sysfs so it would be simpler to run, it can be easily changed to use a file from sysfs.
The following code runs on Python2.7, requires the mock library
{code}
from unittest import TestCase
from tempfile import mkstemp
from mock import patch, Mock
from os import close, remove, write, stat
from posix import stat_result
from tarfile import TarFile
def fake_st_size_side_effect(*args, **kwargs):
src, = args
stats = stat(src)
return stat_result((stats.st_mode, stats.st_ino, stats.st_dev, stats.st_nlink,
stats.st_uid, stats.st_gid, stats.st_size + 10,
stats.st_atime, stats.st_mtime, stats.st_ctime))
class Issue10760TestCase(TestCase):
def setUp(self):
fd, self.src = mkstemp()
write(fd, '\x00' * 4)
close(fd)
fd, self.dst = mkstemp()
close(fd)
def test(self):
with patch("os.lstat") as lstat:
lstat.side_effect = fake_st_size_side_effect
tar_file = TarFile.open(self.dst, 'w:gz')
tar_file.add(self.src)
{code} |
|
Date |
User |
Action |
Args |
2012-09-24 01:53:54 | guyrozendorn | set | recipients:
+ guyrozendorn, lars.gustaebel, Yoni.Tsafir |
2012-09-24 01:53:53 | guyrozendorn | set | messageid: <1348451633.78.0.894636371943.issue10760@psf.upfronthosting.co.za> |
2012-09-24 01:53:53 | guyrozendorn | link | issue10760 messages |
2012-09-24 01:53:52 | guyrozendorn | create | |
|