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
This commit is contained in:
Steve Martinelli 2014-11-12 12:07:43 -05:00
parent c8ddfd8311
commit 27b0ff5cda

View File

@ -10,6 +10,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import os
import uuid
from functional.common import test
@ -25,9 +26,11 @@ class ObjectV1Tests(test.TestCase):
CONTAINER_NAME = uuid.uuid4().hex
OBJECT_NAME = uuid.uuid4().hex
# NOTE(stevemar): Not using setUp since we only want this to run once
with open(OBJECT_NAME, 'w') as f:
f.write('test content')
def setUp(self):
super(ObjectV1Tests, self).setUp()
self.addCleanup(os.remove, self.OBJECT_NAME)
with open(self.OBJECT_NAME, 'w') as f:
f.write('test content')
def test_container_create(self):
raw_output = self.openstack('container create ' + self.CONTAINER_NAME)