← Back to team overview

duplicity-team team mailing list archive

[Merge] lp:~aaron-whitehouse/duplicity/fix_patch_error into lp:duplicity

 

Aaron Whitehouse has proposed merging lp:~aaron-whitehouse/duplicity/fix_patch_error into lp:duplicity.

Requested reviews:
  duplicity-team (duplicity-team)

For more details, see:
https://code.launchpad.net/~aaron-whitehouse/duplicity/fix_patch_error/+merge/266676

Change use of mock.patch in unit tests to accommodate the obsolete version of python-mock on the build server.
-- 
Your team duplicity-team is requested to review the proposed merge of lp:~aaron-whitehouse/duplicity/fix_patch_error into lp:duplicity.
=== modified file 'po/duplicity.pot'
--- po/duplicity.pot	2015-08-02 11:44:34 +0000
+++ po/duplicity.pot	2015-08-03 00:02:14 +0000
@@ -8,7 +8,7 @@
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: Kenneth Loafman <kenneth@xxxxxxxxxxx>\n"
-"POT-Creation-Date: 2015-08-02 06:35-0500\n"
+"POT-Creation-Date: 2015-08-03 00:36+0100\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@xxxxxx>\n"

=== modified file 'testing/unit/test_selection.py'
--- testing/unit/test_selection.py	2015-07-31 08:22:31 +0000
+++ testing/unit/test_selection.py	2015-08-03 00:02:14 +0000
@@ -56,11 +56,17 @@
 
     def test_tuple_include(self):
         """Test include selection function made from a regular filename"""
-        self.assertRaises(FilePrefixError, self.Select.glob_get_normal_sf, "foo", 1)
+        self.assertRaises(FilePrefixError, self.Select.glob_get_normal_sf,
+                          "foo", 1)
 
         sf2 = self.Select.glob_get_sf("testfiles/select/usr/local/bin/", 1)
 
-        with patch('duplicity.path.ROPath.isdir', return_value=True):
+        with patch('duplicity.path.ROPath.isdir') as mock_isdir:
+            mock_isdir.return_value = True
+            # Can't pass the return_value as an argument to patch, i.e.:
+            # with patch('duplicity.path.ROPath.isdir', return_value=True):
+            # as build system's mock is too old to support it.
+
             assert sf2(self.makeext("usr")) == 1
             assert sf2(self.makeext("usr/local")) == 1
             assert sf2(self.makeext("usr/local/bin")) == 1
@@ -70,11 +76,16 @@
 
     def test_tuple_exclude(self):
         """Test exclude selection function made from a regular filename"""
-        self.assertRaises(FilePrefixError, self.Select.glob_get_normal_sf, "foo", 0)
+        self.assertRaises(FilePrefixError, self.Select.glob_get_normal_sf,
+                          "foo", 0)
 
         sf2 = self.Select.glob_get_sf("testfiles/select/usr/local/bin/", 0)
 
-        with patch('duplicity.path.ROPath.isdir', return_value=True):
+        with patch('duplicity.path.ROPath.isdir') as mock_isdir:
+            mock_isdir.return_value = True
+            # Can't pass the return_value as an argument to patch, as build
+            # system's mock is too old to support it.
+
             assert sf2(self.makeext("usr")) is None
             assert sf2(self.makeext("usr/local")) is None
             assert sf2(self.makeext("usr/local/bin")) == 0


Follow ups