← Back to team overview

duplicity-team team mailing list archive

[Merge] lp:~mterry/duplicity/testfixes into lp:duplicity

 

Michael Terry has proposed merging lp:~mterry/duplicity/testfixes into lp:duplicity.

Requested reviews:
  duplicity-team (duplicity-team)

For more details, see:
https://code.launchpad.net/~mterry/duplicity/testfixes/+merge/91935

Here are two changes that help the test suite pass (it got broken after the recent round of merges).

1) When file_naming is asked for a name, don't assert if compression AND encryption are turned on.  They are by default now.  But globals.compression is only meant to take effect if encryption is turned off.  So when encryption is on, just turn off gzip suffixes.

2) Some tests are unit tests that directly import the relevant duplicity code.  So make sure that regular expressions are setup lazily as needed, not once at the start of bin/duplicity.

There are still test failures after these two.  I'm still looking...  But these two seem safe.
-- 
https://code.launchpad.net/~mterry/duplicity/testfixes/+merge/91935
Your team duplicity-team is requested to review the proposed merge of lp:~mterry/duplicity/testfixes into lp:duplicity.
=== modified file 'bin/duplicity'
--- bin/duplicity	2012-02-05 18:13:40 +0000
+++ bin/duplicity	2012-02-07 22:25:29 +0000
@@ -1221,9 +1221,6 @@
     # determine what action we're performing and process command line
     action = commandline.ProcessCommandLine(sys.argv[1:])
 
-    # update the regex with provided file-prefix
-    file_naming.prepare_regex()
-
     # The following is for starting remote debugging in Eclipse with Pydev.
     # Adjust the path to your location and version of Eclipse and Pydev.
     if globals.pydevd:

=== modified file 'duplicity/file_naming.py'
--- duplicity/file_naming.py	2012-01-19 17:10:57 +0000
+++ duplicity/file_naming.py	2012-02-07 22:25:29 +0000
@@ -52,6 +52,9 @@
     global new_sig_re
     global new_sig_re_short
 
+    if full_vol_re:
+        return
+
     full_vol_re = re.compile("^" + globals.file_prefix + "duplicity-full"
                          "\\.(?P<time>.*?)"
                          "\\.vol(?P<num>[0-9]+)"
@@ -172,7 +175,8 @@
     Return appropriate suffix depending on status of
     encryption, compression, and short_filenames.
     """
-    assert not (encrypted and gzipped)
+    if encrypted:
+        gzipped = False
     if encrypted:
         if globals.short_filenames:
             suffix = '.g'
@@ -198,7 +202,8 @@
     filename is of a full or inc manifest file.
     """
     assert dup_time.curtimestr
-    assert not (encrypted and gzipped)
+    if encrypted:
+        gzipped = False
     suffix = get_suffix(encrypted, gzipped)
     part_string = ""
     if globals.short_filenames:
@@ -291,6 +296,7 @@
         """
         Return ParseResults if file is from full backup, None otherwise
         """
+        prepare_regex()
         short = True
         m1 = full_vol_re_short.search(filename)
         m2 = full_manifest_re_short.search(filename)
@@ -313,6 +319,7 @@
         """
         Return ParseResults if file is from inc backup, None otherwise
         """
+        prepare_regex()
         short = True
         m1 = inc_vol_re_short.search(filename)
         m2 = inc_manifest_re_short.search(filename)
@@ -336,6 +343,7 @@
         """
         Return ParseResults if file is a signature, None otherwise
         """
+        prepare_regex()
         short = True
         m = full_sig_re_short.search(filename)
         if not m and not globals.short_filenames:


Follow ups