combox

split and encrypted files between online file storage providers
git clone git://git.ricketyspace.net/combox.git
Log | Files | Refs

commit 7c612e9520aa7d1c41e0aa9eafc0cf00cebb7180
parent c5722f75454eb42ac9fe5cda79fb25f839c3092c
Author: Siddharth Ravikumar <sravik@bgsu.edu>
Date:   Wed,  4 Mar 2015 20:32:45 -0500

new function combox.file.rm_dir

also wrote test for it.

  modified:   combox/file.py
  modified:   tests/file_test.py

Diffstat:
combox/file.py | 8++++++++
tests/file_test.py | 10++++++++++
2 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/combox/file.py b/combox/file.py @@ -129,6 +129,14 @@ def rm_nodedir(directory, config): print e, "Something wrong. report bug to sravik@bgsu.edu" +def rm_dir(directory): + """Removes directory""" + try: + os.rmdir(directory) + except OSError, e: + print e, "Something wrong. report bug to sravik@bgsu.edu" + + def move_nodedir(src, dest, config): """ Moves directory `directory' inside the nodes from old to new location. diff --git a/tests/file_test.py b/tests/file_test.py @@ -150,6 +150,16 @@ class TestFile(object): assert foo_nodedir == node_path(foo_dir, self.config) + def test_rmdir(self): + """Tests rm_dir function""" + new_dir = path.join(self.config['combox_dir'], 'fooius') + os.mkdir(new_dir) + assert path.isdir(new_dir) + + rm_dir(new_dir) + assert not path.isdir(new_dir) + + @classmethod def teardown_class(self): """Purge the mess created by this test."""