summaryrefslogtreecommitdiff
path: root/rdiff-backup/testing/robusttest.py
diff options
context:
space:
mode:
authorbescoto <bescoto@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109>2002-12-31 08:46:22 +0000
committerbescoto <bescoto@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109>2002-12-31 08:46:22 +0000
commitb53bfd4d41252426cb050ef896676034d92e3ef7 (patch)
tree5d03aedc0a408da049390e8e9d8a7d28ad596c49 /rdiff-backup/testing/robusttest.py
parentc08ca27a381443d6e72ee8d16269e5a535df58d1 (diff)
downloadrdiff-backup-b53bfd4d41252426cb050ef896676034d92e3ef7.tar.gz
Various changes for v0.11.1 (see CHANGELOG)
git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup/trunk@256 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109
Diffstat (limited to 'rdiff-backup/testing/robusttest.py')
-rw-r--r--rdiff-backup/testing/robusttest.py60
1 files changed, 16 insertions, 44 deletions
diff --git a/rdiff-backup/testing/robusttest.py b/rdiff-backup/testing/robusttest.py
index 8c6d51c..6b9e356 100644
--- a/rdiff-backup/testing/robusttest.py
+++ b/rdiff-backup/testing/robusttest.py
@@ -1,32 +1,11 @@
+
import os, unittest
from commontest import *
from rdiff_backup import rpath, robust, TempFile, Globals
-
-
-class TestRobustAction(unittest.TestCase):
- """Test some robust actions"""
- def testCopyWithAttribs(self):
- """Test copy with attribs action"""
- rpin = rpath.RPath(Globals.local_connection, "./testfiles/robust/in")
- fp = open("./testfiles/robust/in", "wb")
- fp.write("hello there")
- fp.close()
- os.chmod("./testfiles/robust/in", 0604)
- rpin.setdata()
- assert rpin.isreg() and rpin.getperms() % 01000 == 0604
-
- rpout = rpath.RPath(Globals.local_connection, "./testfiles/robust/out")
- robust.copy_with_attribs_action(rpin, rpout).execute()
- if not rpout == rpin:
- print rpout, rpin
- assert 0
-
- rpout.delete()
- rpin.delete()
class TempFileTest(unittest.TestCase):
- """Test creation and management of tempfiles"""
+ """Test creation and management of tempfiles in TempFile module"""
rp_base = rpath.RPath(Globals.local_connection,
"./testfiles/robust/testfile_base")
def testBasic(self):
@@ -61,26 +40,19 @@ class TempFileTest(unittest.TestCase):
assert destination.lstat()
destination.delete()
-
-class SaveStateTest(unittest.TestCase):
- """Test SaveState class"""
- data_dir = rpath.RPath(Globals.local_connection, "testfiles/robust")
- def testSymlinking(self):
- """Test recording last file with symlink"""
- last_rorp = rpath.RORPath(('usr', 'local', 'bin', 'ls'))
- Globals.rbdir = self.data_dir
- Time.setcurtime()
- SetConnections.BackupInitConnections(Globals.local_connection,
- Globals.local_connection)
- robust.SaveState.init_filenames()
- robust.SaveState.record_last_file_action(last_rorp).execute()
-
- sym_rp = rpath.RPath(Globals.local_connection,
- "testfiles/robust/last-file-incremented.%s.data" %
- Time.curtimestr)
- assert sym_rp.issym()
- assert sym_rp.readlink() == "increments/usr/local/bin/ls"
- sym_rp.delete()
-
+class RobustTest(unittest.TestCase):
+ """Test robust module"""
+ def test_check_common_error(self):
+ """Test capturing errors"""
+ def cause_catchable_error(a):
+ os.lstat("aoenuthaoeu/aosutnhcg.4fpr,38p")
+ def cause_uncatchable_error():
+ ansoethusaotneuhsaotneuhsaontehuaou
+ result = robust.check_common_error(None, cause_catchable_error, [1])
+ assert result is None, result
+ try: robust.check_common_error(None, cause_uncatchable_error)
+ except NameError: pass
+ else: assert 0, "Key error not raised"
+
if __name__ == '__main__': unittest.main()