Browse Source

make sure that files aren't closed when passed in..

test_fixup
John-Mark Gurney 2 years ago
parent
commit
e658620f38
1 changed files with 10 additions and 0 deletions
  1. +10
    -0
      tests.py

+ 10
- 0
tests.py View File

@@ -415,6 +415,16 @@ class TestArchive(unittest.TestCase):

self.assertTrue(arch.f.closed)

def test_noclose(self):
fname = self.fixtures / 'testfile.tar.gz'

with open(fname) as fp:
with Archive(fp) as arch:
pass

self.assertFalse(fp.closed)

self.assertTrue(fp.closed)

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

Loading…
Cancel
Save