Stop popen patch correctly in test_agent_linux_utils

Fixes bug #1225009

Change-Id: Ic9f3491be2fb7481bbf3fd843a421d66d9248a20
This commit is contained in:
armando-migliaccio 2013-09-13 07:44:40 -07:00
parent ca99b92719
commit 644f0c64c9

View File

@ -29,9 +29,9 @@ class AgentUtilsExecuteTest(base.BaseTestCase):
self.test_file = self.useFixture( self.test_file = self.useFixture(
fixtures.TempDir()).join("test_execute.tmp") fixtures.TempDir()).join("test_execute.tmp")
open(self.test_file, 'w').close() open(self.test_file, 'w').close()
instance = mock.patch("subprocess.Popen.communicate") self.mock_popen_p = mock.patch("subprocess.Popen.communicate")
self.mock_popen = instance.start() self.mock_popen = self.mock_popen_p.start()
self.addCleanup(self.mock_popen.stop) self.addCleanup(self.mock_popen_p.stop)
def test_without_helper(self): def test_without_helper(self):
expected = "%s\n" % self.test_file expected = "%s\n" % self.test_file