From 87fc21c7cfcce2a3e23a84fddcfd1309cd884716 Mon Sep 17 00:00:00 2001 From: Alistair Coles Date: Mon, 8 Feb 2016 15:31:42 +0000 Subject: [PATCH] Speed up functional testing test/functional/tests.py:TestObjectVersioningUTF8 does not clean up the versions files it creates because the class's multiple inheritance is such that it does not call the tearDown method in TestObjectVersioning. As a result, any attempt to clean up account containers wastes time retrying container delete requests. This occurs either in the setUp for TestSloEnv, if the TestSlo class is included in a test run, or in the tests.py package tearDown method. On the author's dev machine this patch reduces the execution time of functional tests in tests.py by approx 30% or 1 minute. Change-Id: I8194672bf2ca82435df5868720b6a55a79b94413 --- test/functional/tests.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/test/functional/tests.py b/test/functional/tests.py index 5dabec4c7f..7f9ef3ea3c 100644 --- a/test/functional/tests.py +++ b/test/functional/tests.py @@ -3359,16 +3359,19 @@ class TestObjectVersioning(Base): "Expected versioning_enabled to be True/False, got %r" % (self.env.versioning_enabled,)) - def tearDown(self): - super(TestObjectVersioning, self).tearDown() + def _tear_down_files(self): try: - # only delete files and not container + # only delete files and not containers # as they were configured in self.env self.env.versions_container.delete_files() self.env.container.delete_files() except ResponseError: pass + def tearDown(self): + super(TestObjectVersioning, self).tearDown() + self._tear_down_files() + def test_clear_version_option(self): # sanity self.assertEqual(self.env.container.info()['versions'], @@ -3602,6 +3605,10 @@ class TestObjectVersioning(Base): class TestObjectVersioningUTF8(Base2, TestObjectVersioning): set_up = False + def tearDown(self): + self._tear_down_files() + super(TestObjectVersioningUTF8, self).tearDown() + class TestCrossPolicyObjectVersioning(TestObjectVersioning): env = TestCrossPolicyObjectVersioningEnv