Skip to content

Commit 27b0ff5

Browse files
author
Steve Martinelli
committed
cleanup files that are created for swift functional tests
Currently this portion of code is also being run when running tox to debug local tests. Which is very annoying since a developer will end up with a bunch of uuid files. Rather than creating it once per run, we can have a setup/teardown that is handled safely. Change-Id: I49a0bb3d14f24c54da93458d1e3b9093a1120453
1 parent c8ddfd8 commit 27b0ff5

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

‎functional/tests/test_object.py‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
# License for the specific language governing permissions and limitations
1111
# under the License.
1212

13+
import os
1314
import uuid
1415

1516
from functional.common import test
@@ -25,9 +26,11 @@ class ObjectV1Tests(test.TestCase):
2526
CONTAINER_NAME = uuid.uuid4().hex
2627
OBJECT_NAME = uuid.uuid4().hex
2728

28-
# NOTE(stevemar): Not using setUp since we only want this to run once
29-
with open(OBJECT_NAME, 'w') as f:
30-
f.write('test content')
29+
def setUp(self):
30+
super(ObjectV1Tests, self).setUp()
31+
self.addCleanup(os.remove, self.OBJECT_NAME)
32+
with open(self.OBJECT_NAME, 'w') as f:
33+
f.write('test content')
3134

3235
def test_container_create(self):
3336
raw_output = self.openstack('container create ' + self.CONTAINER_NAME)

0 commit comments

Comments
 (0)