summaryrefslogtreecommitdiffstats
path: root/tests/file_test.py
diff options
context:
space:
mode:
authorSiddharth Ravikumar <sravik@bgsu.edu>2015-03-19 22:32:16 -0400
committerSiddharth Ravikumar <sravik@bgsu.edu>2015-03-19 22:32:16 -0400
commitc6461d8d83d5f086aee978ab08116b0024aab939 (patch)
tree647873ed7ad62b94e693376b403587be44fb83dd /tests/file_test.py
parent8b4f318e782b385d07a5e3cf7eb1160abcc1b5a7 (diff)
In tests, the code that purges the files/directories in `purge_list' is now a function.
modified: tests/events_test.py modified: tests/file_test.py modified: tests/utils.py
Diffstat (limited to 'tests/file_test.py')
-rw-r--r--tests/file_test.py14
1 files changed, 6 insertions, 8 deletions
diff --git a/tests/file_test.py b/tests/file_test.py
index 8065ff7..6517943 100644
--- a/tests/file_test.py
+++ b/tests/file_test.py
@@ -27,7 +27,7 @@ from shutil import copyfile
from combox.config import get_nodedirs
from combox.crypto import split_and_encrypt
from combox.file import *
-from tests.utils import get_config, rm_nodedirs, rm_configdir
+from tests.utils import get_config, rm_nodedirs, rm_configdir, purge
class TestFile(object):
@@ -185,6 +185,11 @@ class TestFile(object):
self.purge_list.append(new_dir)
+ def teardown(self):
+ """Cleans up things after each test in this class."""
+ purge(self.purge_list)
+
+
@classmethod
def teardown_class(self):
"""Purge the mess created by this test."""
@@ -192,10 +197,3 @@ class TestFile(object):
rm_shards(self.TEST_FILE, self.config)
rm_nodedirs(self.config)
rm_configdir()
-
- for f in self.purge_list:
- if path.exists(f) and path.isfile(f):
- os.remove(f)
- elif path.exists(f) and path.isdir(f):
- purge_dir(f)
- os.rmdir(f)