Fix integration.modules.git.GitModuleTest.test_archive on py26

Fix borrowed from: http://stackoverflow.com/questions/6086603/statement-with-and-tarfile
This commit is contained in:
Jenkins 2015-08-19 11:31:38 -06:00
parent e57f767244
commit dbbe206e19

View File

@ -2,6 +2,7 @@
# Import Python Libs # Import Python Libs
from __future__ import absolute_import from __future__ import absolute_import
from contextlib import closing
import errno import errno
import logging import logging
import os import os
@ -155,7 +156,7 @@ class GitModuleTest(integration.ModuleCase):
) )
) )
self.assertTrue(tarfile.is_tarfile(tar_archive)) self.assertTrue(tarfile.is_tarfile(tar_archive))
with tarfile.open(tar_archive, 'r') as tar_obj: with closing(tarfile.open(tar_archive, 'r')) as tar_obj:
self.assertEqual( self.assertEqual(
tar_obj.getnames(), tar_obj.getnames(),
['foo', 'foo/bar', 'foo/baz', 'foo/foo', 'foo/qux', ['foo', 'foo/bar', 'foo/baz', 'foo/foo', 'foo/qux',