From 5d9f259b8341922929c21dd94241c888f5a5ebfb Mon Sep 17 00:00:00 2001 From: stealthycoin Date: Sat, 2 Feb 2019 16:02:09 -0800 Subject: [PATCH] Get functional tests passing on windows The streaming tests added a .files property to the base Params test class that is used by many other test cases. The history recorder tests in particular needed control of how the files were then cleaned up to prevent file connections from preventing their deletion on windows. Since the cleanup was added to the base class as well this was now happening in the superclass before all the connections to the file had been correctly closed in the subclass's tearDown method. The fix was just to move the files property down to the specific test subclass that needed it. All the subclasses of this do not need it and we probably shouldn't modify a heavily used base class for functionality needed by a very small set of subclasses. --- awscli/testutils.py | 2 -- tests/functional/test_streaming_output.py | 9 +++++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/awscli/testutils.py b/awscli/testutils.py index 6c8bddbd75d5..7287a42752b9 100644 --- a/awscli/testutils.py +++ b/awscli/testutils.py @@ -363,7 +363,6 @@ def setUp(self): self.operations_called = [] self.parsed_responses = None self.driver = create_clidriver() - self.files = FileCreator() def tearDown(self): # This clears all the previous registrations. @@ -371,7 +370,6 @@ def tearDown(self): if self.make_request_is_patched: self.make_request_patch.stop() self.make_request_is_patched = False - self.files.remove_all() def before_call(self, params, **kwargs): self._store_params(params) diff --git a/tests/functional/test_streaming_output.py b/tests/functional/test_streaming_output.py index e9a9f67cfc30..1a6ce849484a 100644 --- a/tests/functional/test_streaming_output.py +++ b/tests/functional/test_streaming_output.py @@ -13,10 +13,19 @@ # language governing permissions and limitations under the License. from awscli.compat import six from awscli.testutils import BaseAWSCommandParamsTest +from awscli.testutils import FileCreator class TestStreamingOutput(BaseAWSCommandParamsTest): + def setUp(self): + super(TestStreamingOutput, self).setUp() + self.files = FileCreator() + + def tearDown(self): + super(TestStreamingOutput, self).tearDown() + self.files.remove_all() + def test_get_media_streaming_output(self): cmdline = ( 'kinesis-video-media get-media --stream-name test-stream '