Closed
Description
I am using zipfile package for creating zip file. The below test fails. Is there any way to make it work?
import os
import zipfile
from pyfakefs import fake_filesystem_unittest
class TestPackageBuilder(fake_filesystem_unittest.TestCase):
def setUp(self):
self.setUpPyfakefs()
def test_zip(self):
self.fs.CreateFile(u'C:\\work\\readme.txt', contents='')
zip_file_path = os.path.join(u'c:\\work', 'some_file.zip')
with zipfile.ZipFile(zip_file_path, 'w') as zip_file:
zip_file.write(u'C:\\work\\readme.txt')
self.assertFileExists(u'c:\\work\\some_file.zip')
def assertFileExists(self, file_path):
self.assertTrue(os.path.exists(file_path), msg='File {0} does not exist'.format(file_path))