From 2ab6172302e91351e40942673828c93c67e2f253 Mon Sep 17 00:00:00 2001 From: Mark Berger <mark.berger.j@gmail.com> Date: Mon, 24 Jun 2013 18:28:05 -0400 Subject: [PATCH] Adds delete_all_shares --- src/allmydata/test/no_network.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/allmydata/test/no_network.py b/src/allmydata/test/no_network.py index 7c904919..8dd9a2f9 100644 --- a/src/allmydata/test/no_network.py +++ b/src/allmydata/test/no_network.py @@ -13,7 +13,7 @@ # Tubs, so it is not useful for tests that involve a Helper, a KeyGenerator, # or the control.furl . -import os.path +import os from zope.interface import implements from twisted.application import service from twisted.internet import defer, reactor @@ -401,6 +401,12 @@ class GridTestMixin: if i_shnum in shnums: os.unlink(i_sharefile) + def delete_all_shares(self, serverdir): + sharedir = os.path.join(serverdir, "shares") + for prefixdir in os.listdir(sharedir): + if prefixdir != 'incoming': + fileutil.rm_dir(os.path.join(sharedir, prefixdir)) + def corrupt_share(self, (shnum, serverid, sharefile), corruptor_function): sharedata = open(sharefile, "rb").read() corruptdata = corruptor_function(sharedata) -- 2.45.2