Merge lp:~aaron-whitehouse/duplicity/fix_patch_error into lp:~duplicity-team/duplicity/0.7-series

Proposed by Aaron Whitehouse
Status: Merged
Merged at revision: 1118
Proposed branch: lp:~aaron-whitehouse/duplicity/fix_patch_error
Merge into: lp:~duplicity-team/duplicity/0.7-series
Diff against target: 55 lines (+16/-5)
2 files modified
po/duplicity.pot (+1/-1)
testing/unit/test_selection.py (+15/-4)
To merge this branch: bzr merge lp:~aaron-whitehouse/duplicity/fix_patch_error
Reviewer Review Type Date Requested Status
duplicity-team Pending
Review via email: mp+266676@code.launchpad.net

Description of the change

Change use of mock.patch in unit tests to accommodate the obsolete version of python-mock on the build server.

To post a comment you must log in.
Revision history for this message
Aaron Whitehouse (aaron-whitehouse) wrote :

Also very minor PEP8 line length fixes.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'po/duplicity.pot'
2--- po/duplicity.pot 2015-08-02 11:44:34 +0000
3+++ po/duplicity.pot 2015-08-03 00:02:14 +0000
4@@ -8,7 +8,7 @@
5 msgstr ""
6 "Project-Id-Version: PACKAGE VERSION\n"
7 "Report-Msgid-Bugs-To: Kenneth Loafman <kenneth@loafman.com>\n"
8-"POT-Creation-Date: 2015-08-02 06:35-0500\n"
9+"POT-Creation-Date: 2015-08-03 00:36+0100\n"
10 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
11 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
12 "Language-Team: LANGUAGE <LL@li.org>\n"
13
14=== modified file 'testing/unit/test_selection.py'
15--- testing/unit/test_selection.py 2015-07-31 08:22:31 +0000
16+++ testing/unit/test_selection.py 2015-08-03 00:02:14 +0000
17@@ -56,11 +56,17 @@
18
19 def test_tuple_include(self):
20 """Test include selection function made from a regular filename"""
21- self.assertRaises(FilePrefixError, self.Select.glob_get_normal_sf, "foo", 1)
22+ self.assertRaises(FilePrefixError, self.Select.glob_get_normal_sf,
23+ "foo", 1)
24
25 sf2 = self.Select.glob_get_sf("testfiles/select/usr/local/bin/", 1)
26
27- with patch('duplicity.path.ROPath.isdir', return_value=True):
28+ with patch('duplicity.path.ROPath.isdir') as mock_isdir:
29+ mock_isdir.return_value = True
30+ # Can't pass the return_value as an argument to patch, i.e.:
31+ # with patch('duplicity.path.ROPath.isdir', return_value=True):
32+ # as build system's mock is too old to support it.
33+
34 assert sf2(self.makeext("usr")) == 1
35 assert sf2(self.makeext("usr/local")) == 1
36 assert sf2(self.makeext("usr/local/bin")) == 1
37@@ -70,11 +76,16 @@
38
39 def test_tuple_exclude(self):
40 """Test exclude selection function made from a regular filename"""
41- self.assertRaises(FilePrefixError, self.Select.glob_get_normal_sf, "foo", 0)
42+ self.assertRaises(FilePrefixError, self.Select.glob_get_normal_sf,
43+ "foo", 0)
44
45 sf2 = self.Select.glob_get_sf("testfiles/select/usr/local/bin/", 0)
46
47- with patch('duplicity.path.ROPath.isdir', return_value=True):
48+ with patch('duplicity.path.ROPath.isdir') as mock_isdir:
49+ mock_isdir.return_value = True
50+ # Can't pass the return_value as an argument to patch, as build
51+ # system's mock is too old to support it.
52+
53 assert sf2(self.makeext("usr")) is None
54 assert sf2(self.makeext("usr/local")) is None
55 assert sf2(self.makeext("usr/local/bin")) == 0

Subscribers

People subscribed via source and target branches