From 967f0ff8372b09a394bd77a3b7bc7d986257a219 Mon Sep 17 00:00:00 2001 From: Peter Stachowski Date: Mon, 4 Apr 2016 19:09:25 +0000 Subject: [PATCH] Fix inadvertent generation of file during tox test When running py27 or py34 tox tests, a '4321_4321_4321.dat' file is created and not cleaned up. This is due to a missing mock in the module_retrieve test. The 'open' method is now mocked and the file is not created. Change-Id: I8e2524961b3cb2ac01b65d5ce11d476ad3a81662 Closed-Bug: #1565959 --- troveclient/tests/test_v1_shell.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/troveclient/tests/test_v1_shell.py b/troveclient/tests/test_v1_shell.py index 11767da7..6f67784f 100644 --- a/troveclient/tests/test_v1_shell.py +++ b/troveclient/tests/test_v1_shell.py @@ -600,11 +600,12 @@ class ShellTest(utils.TestCase): def test_module_retrieve(self): with mock.patch.object(troveclient.v1.modules.Module, '__getattr__', mock.Mock(return_value='4321')): - self.run_command('module-retrieve 1234') - self.assert_called( - 'GET', - '/instances/1234/modules?' - 'include_contents=True&from_guest=True') + with mock.patch.object(builtins, 'open'): + self.run_command('module-retrieve 1234') + self.assert_called( + 'GET', + '/instances/1234/modules?' + 'include_contents=True&from_guest=True') def test_limit_list(self): self.run_command('limit-list')