From c9a5290224dd7254a23cb6e5e3baa43a21fd2362 Mon Sep 17 00:00:00 2001
From: Siddharth Ravikumar <sravik@bgsu.edu>
Date: Fri, 13 Feb 2015 11:11:02 -0500
Subject: tests/utils.py: added new function rm_nodedirs.

rm_nodedirs purges the node directories. This function will be used
later to remove the test node directories.
---
 tests/utils.py | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

(limited to 'tests')

diff --git a/tests/utils.py b/tests/utils.py
index 8b974ed..f21bd38 100644
--- a/tests/utils.py
+++ b/tests/utils.py
@@ -22,7 +22,7 @@ from nose.tools import *
 from os import path, remove, rmdir
 
 from combox.config import config_cb, get_nodedirs
-from combox.file import relative_path
+from combox.file import relative_path, purge_dir
 
 def get_input_func():
     """Returns the input function
@@ -57,6 +57,17 @@ def get_config():
     return config_cb(config_dir, pass_func, input_func, write=False)
 
 
+def rm_nodedirs(config):
+    """Removes node directories"""
+    nodes = get_nodedirs(config)
+    for node in nodes:
+        try:
+            purge_dir(node)
+            rmdir(node)
+        except OSError, e:
+            print "Problem deleting", node, e
+
+
 def shardedp(f):
     """Checks if file's shards exists in the node directories"""
 
-- 
cgit v1.2.3