Skip to content

Commit

Permalink
Import zipfile to avoid problem with late import (#428)
Browse files Browse the repository at this point in the history
- fixes #427
  • Loading branch information
mrbean-bremen authored and jmcgeheeiv committed Sep 9, 2018
1 parent 2638de2 commit eeb80f6
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions pyfakefs/fake_filesystem_unittest.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import sys
import tempfile
import unittest
import zipfile # import here to make sure it gets correctly stubbed, see #427

from pyfakefs.deprecator import Deprecator

Expand Down
14 changes: 14 additions & 0 deletions pyfakefs/tests/fake_filesystem_unittest_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -378,5 +378,19 @@ def test_set_up_pyfakefs(self):
self.assertIsInstance(self.fs, fake_filesystem.FakeFilesystem)


class TestShutilWithZipfile(fake_filesystem_unittest.TestCase):
"""Regression test for #427."""
def setUp(self):
self.setUpPyfakefs()
self.fs.create_file('foo/bar')

def test_a(self):
shutil.make_archive('archive', 'zip', root_dir='foo')

def test_b(self):
# used to fail because 'bar' could not be found
shutil.make_archive('archive', 'zip', root_dir='foo')


if __name__ == "__main__":
unittest.main()

0 comments on commit eeb80f6

Please sign in to comment.