diff options
author | Elrond <elrond+mediagoblin.org@samba-tng.org> | 2013-04-21 19:19:40 +0200 |
---|---|---|
committer | Elrond <elrond+mediagoblin.org@samba-tng.org> | 2013-04-21 19:26:57 +0200 |
commit | fd1202b7745a536428cdfe1d862a07bf59a3ad43 (patch) | |
tree | bd8c5ec12211402a3a1ad81b3d5f44edb7e483d4 /mediagoblin/tests/test_workbench.py | |
parent | 449863863a747279b038f9b195ac60c547b73fe2 (diff) | |
download | mediagoblin-fd1202b7745a536428cdfe1d862a07bf59a3ad43.tar.lz mediagoblin-fd1202b7745a536428cdfe1d862a07bf59a3ad43.tar.xz mediagoblin-fd1202b7745a536428cdfe1d862a07bf59a3ad43.zip |
Cleanup storage after test, and test .delete_dir().
The storage tests work in the system's tmpdir. The python
docs say, we should clean up after using things. Yes the
directory should be cleaned up on reboot, but if running
tests a lot, the tmpdir could fill up, so we should really
cleanup.
So use the new .delete_dir() on the storage interface to
cleanup test dirs and get them finally removed with
os.rmdir. All nicely packed into cleanup_storage().
Diffstat (limited to 'mediagoblin/tests/test_workbench.py')
-rw-r--r-- | mediagoblin/tests/test_workbench.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/mediagoblin/tests/test_workbench.py b/mediagoblin/tests/test_workbench.py index 9cd49671..6695618b 100644 --- a/mediagoblin/tests/test_workbench.py +++ b/mediagoblin/tests/test_workbench.py @@ -21,7 +21,7 @@ import tempfile from mediagoblin.tools import workbench from mediagoblin.mg_globals import setup_globals from mediagoblin.decorators import get_workbench -from mediagoblin.tests.test_storage import get_tmp_filestorage +from mediagoblin.tests.test_storage import get_tmp_filestorage, cleanup_storage class TestWorkbench(object): @@ -76,6 +76,7 @@ class TestWorkbench(object): assert filename == os.path.join( tmpdir, 'dir1/dir2/ourfile.txt') this_storage.delete_file(filepath) + cleanup_storage(this_storage, tmpdir, ['dir1', 'dir2']) # with a fake remote file storage tmpdir, this_storage = get_tmp_filestorage(fake_remote=True) @@ -102,6 +103,7 @@ class TestWorkbench(object): this_workbench.dir, 'thisfile.text') this_storage.delete_file(filepath) + cleanup_storage(this_storage, tmpdir, ['dir1', 'dir2']) this_workbench.destroy() def test_workbench_decorator(self): |