From dbbe206e19ea0093f7cc2c1c8a800b07e9d5c018 Mon Sep 17 00:00:00 2001 From: Jenkins Date: Wed, 19 Aug 2015 11:31:38 -0600 Subject: [PATCH] Fix integration.modules.git.GitModuleTest.test_archive on py26 Fix borrowed from: http://stackoverflow.com/questions/6086603/statement-with-and-tarfile --- tests/integration/modules/git.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/integration/modules/git.py b/tests/integration/modules/git.py index 785f0c643c..050eecfded 100644 --- a/tests/integration/modules/git.py +++ b/tests/integration/modules/git.py @@ -2,6 +2,7 @@ # Import Python Libs from __future__ import absolute_import +from contextlib import closing import errno import logging import os @@ -155,7 +156,7 @@ class GitModuleTest(integration.ModuleCase): ) ) 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( tar_obj.getnames(), ['foo', 'foo/bar', 'foo/baz', 'foo/foo', 'foo/qux',