Merge lp:~aaron-whitehouse/duplicity/08-adorn-strings into lp:~duplicity-team/duplicity/0.8-series
- 08-adorn-strings
- Merge into 0.8-series
Status: | Merged |
---|---|
Merged at revision: | 1309 |
Proposed branch: | lp:~aaron-whitehouse/duplicity/08-adorn-strings |
Merge into: | lp:~duplicity-team/duplicity/0.8-series |
Diff against target: |
1997 lines (+246/-251) 6 files modified
duplicity/globmatch.py (+6/-6) duplicity/selection.py (+37/-37) testing/functional/test_selection.py (+77/-77) testing/test_code.py (+0/-5) testing/unit/test_globmatch.py (+40/-40) testing/unit/test_selection.py (+86/-86) |
To merge this branch: | bzr merge lp:~aaron-whitehouse/duplicity/08-adorn-strings |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
duplicity-team | Pending | ||
Review via email: mp+350078@code.launchpad.net |
Commit message
Adorning string literals (normally to make these unicode), in support of a transition to Python 3.
See https:/
* Adorn string in duplicity/
* Adorn strings in testing/
* Adorn strings in selection.py
* Adorn strings in functional/
* Remove ignores for these files in test_code.py
Description of the change
Adorning string literals (normally to make these unicode), in support of a transition to Python 3.
See https:/
* Adorn string in duplicity/
* Adorn strings in testing/
* Adorn strings in selection.py
* Adorn strings in functional/
* Remove ignores for these files in test_code.py
Note that I accidentally wrote "adorn globs" instead of "adorn strings" in some of the commit messages.
edso (ed.so) wrote : | # |
Aaron Whitehouse (aaron-whitehouse) wrote : | # |
Thanks Ede,
On 2018-07-20 10:21, edso wrote:
> question. does it really make sense to adorn singular strings meant as
> a code comment only eg.
>
> class GlobbingError(
> - """Something has gone wrong when parsing a glob string"""
> + u"""Something has gone wrong when parsing a glob string"""
> pass
>
> ..ede
It's a fair question. I certainly do not see any harm, but potentially
there is no benefit either -- are there any situations that the unclear
encoding of a docstring could cause us problems?
If not and people would rather not add these, I can modify the test in
find_unadorned_
with ' """ ' the line after a def).
Thoughts?
Aaron
Kenneth Loafman (kenneth-loafman) wrote : | # |
I really don't see it makes a lot of difference. Doc generators are used to extracting these strings as unadorned, so we could leave them. If you do a lot of regex replacement to adorn the strings it would be a pain to skip. On a purely aesthetic note, I'd just as soon adorn them.
edso (ed.so) wrote : | # |
On 20.07.2018 12:46, Aaron wrote:
> Thanks Ede,
>
> On 2018-07-20 10:21, edso wrote:
>> question. does it really make sense to adorn singular strings meant as
>> a code comment only eg.
>>
>> class GlobbingError(
>> - """Something has gone wrong when parsing a glob string"""
>> + u"""Something has gone wrong when parsing a glob string"""
>> pass
>>
>> ..ede
>
> It's a fair question. I certainly do not see any harm, but potentially there is no benefit either -- are there any situations that the unclear encoding of a docstring could cause us problems?
>
> If not and people would rather not add these, I can modify the test in find_unadorned_
>
> Thoughts?
naa.. too much hassle. leave it in, does not really help but hurt either. was just curious.. ede/duply.net
Preview Diff
1 | === modified file 'duplicity/globmatch.py' |
2 | --- duplicity/globmatch.py 2017-12-01 22:39:33 +0000 |
3 | +++ duplicity/globmatch.py 2018-07-19 21:12:04 +0000 |
4 | @@ -30,17 +30,17 @@ |
5 | |
6 | |
7 | class GlobbingError(Exception): |
8 | - """Something has gone wrong when parsing a glob string""" |
9 | + u"""Something has gone wrong when parsing a glob string""" |
10 | pass |
11 | |
12 | |
13 | class FilePrefixError(GlobbingError): |
14 | - """Signals that a specified file doesn't start with correct prefix""" |
15 | + u"""Signals that a specified file doesn't start with correct prefix""" |
16 | pass |
17 | |
18 | |
19 | def _glob_get_prefix_regexs(glob_str): |
20 | - """Return list of regexps equivalent to prefixes of glob_str""" |
21 | + u"""Return list of regexps equivalent to prefixes of glob_str""" |
22 | # Internal. Used by glob_get_normal_sf. |
23 | glob_parts = glob_str.split(u"/") |
24 | if u"" in glob_parts[1:-1]: |
25 | @@ -56,7 +56,7 @@ |
26 | |
27 | |
28 | def select_fn_from_glob(glob_str, include, ignore_case=False): |
29 | - """Return a function test_fn(path) which |
30 | + u"""Return a function test_fn(path) which |
31 | tests whether path matches glob, as per the Unix shell rules, taking as |
32 | arguments a path, a glob string and include (0 indicating that the glob |
33 | string is an exclude glob and 1 indicating that it is an include glob, |
34 | @@ -147,7 +147,7 @@ |
35 | |
36 | |
37 | def glob_to_regex(pat): |
38 | - """Returned regular expression equivalent to shell glob pat |
39 | + u"""Returned regular expression equivalent to shell glob pat |
40 | |
41 | Currently only the ?, *, [], and ** expressions are supported. |
42 | Ranges like [a-z] are currently unsupported. There is no |
43 | @@ -161,7 +161,7 @@ |
44 | |
45 | assert isinstance(pat, unicode) |
46 | |
47 | - i, n, res = 0, len(pat), '' |
48 | + i, n, res = 0, len(pat), u'' |
49 | while i < n: |
50 | c, s = pat[i], pat[i:i + 2] |
51 | i = i + 1 |
52 | |
53 | === modified file 'duplicity/selection.py' |
54 | --- duplicity/selection.py 2018-06-08 09:46:45 +0000 |
55 | +++ duplicity/selection.py 2018-07-19 21:12:04 +0000 |
56 | @@ -35,7 +35,7 @@ |
57 | from duplicity.globmatch import GlobbingError, FilePrefixError, \ |
58 | select_fn_from_glob |
59 | |
60 | -"""Iterate exactly the requested files in a directory |
61 | +u"""Iterate exactly the requested files in a directory |
62 | |
63 | Parses includes and excludes to yield correct files. More |
64 | documentation on what this code does can be found on the man page. |
65 | @@ -44,12 +44,12 @@ |
66 | |
67 | |
68 | class SelectError(Exception): |
69 | - """Some error dealing with the Select class""" |
70 | + u"""Some error dealing with the Select class""" |
71 | pass |
72 | |
73 | |
74 | class Select: |
75 | - """Iterate appropriate Paths in given directory |
76 | + u"""Iterate appropriate Paths in given directory |
77 | |
78 | This class acts as an iterator on account of its next() method. |
79 | Basically, it just goes through all the files in a directory in |
80 | @@ -83,17 +83,17 @@ |
81 | |
82 | """ |
83 | # This re should not match normal filenames, but usually just globs |
84 | - glob_re = re.compile("(.*[*?[]|ignorecase\\:)", re.I | re.S) |
85 | + glob_re = re.compile(u"(.*[*?[]|ignorecase\\:)", re.I | re.S) |
86 | |
87 | def __init__(self, path): |
88 | - """Initializer, called with Path of root directory""" |
89 | + u"""Initializer, called with Path of root directory""" |
90 | assert isinstance(path, Path), str(path) |
91 | self.selection_functions = [] |
92 | self.rootpath = path |
93 | self.prefix = self.rootpath.uc_name |
94 | |
95 | def set_iter(self): |
96 | - """Initialize generator, prepare to iterate.""" |
97 | + u"""Initialize generator, prepare to iterate.""" |
98 | # Externally-accessed method |
99 | self.rootpath.setdata() # this may have changed since Select init |
100 | self.iter = self.Iterate(self.rootpath) |
101 | @@ -102,7 +102,7 @@ |
102 | return self |
103 | |
104 | def Iterate(self, path): |
105 | - """Return iterator yielding paths in path |
106 | + u"""Return iterator yielding paths in path |
107 | |
108 | This function looks a bit more complicated than it needs to be |
109 | because it avoids extra recursion (and no extra function calls |
110 | @@ -116,20 +116,20 @@ |
111 | try: |
112 | mode = os.stat(fullpath)[stat.ST_MODE] |
113 | if stat.S_ISSOCK(mode): |
114 | - log.Info(_("Skipping socket %s") % util.fsdecode(fullpath), |
115 | + log.Info(_(u"Skipping socket %s") % util.fsdecode(fullpath), |
116 | log.InfoCode.skipping_socket, |
117 | util.escape(fullpath)) |
118 | else: |
119 | - log.Warn(_("Error initializing file %s") % util.fsdecode(fullpath), |
120 | + log.Warn(_(u"Error initializing file %s") % util.fsdecode(fullpath), |
121 | log.WarningCode.cannot_iterate, |
122 | util.escape(fullpath)) |
123 | except OSError: |
124 | - log.Warn(_("Error accessing possibly locked file %s") % util.fsdecode(fullpath), |
125 | + log.Warn(_(u"Error accessing possibly locked file %s") % util.fsdecode(fullpath), |
126 | log.WarningCode.cannot_stat, util.escape(fullpath)) |
127 | return None |
128 | |
129 | def diryield(path): |
130 | - """Generate relevant files in directory path |
131 | + u"""Generate relevant files in directory path |
132 | |
133 | Returns (path, num) where num == 0 means path should be |
134 | generated normally, num == 1 means the path is a directory |
135 | @@ -144,12 +144,12 @@ |
136 | error_handler, Path.append, (path, filename)) |
137 | if new_path: |
138 | s = self.Select(new_path) |
139 | - if (new_path.type in ["reg", "dir"] |
140 | + if (new_path.type in [u"reg", u"dir"] |
141 | and not os.access(new_path.name, os.R_OK)) \ |
142 | and (s == 1 or s == 2): |
143 | # Path is a file or folder that cannot be read, but |
144 | # should be included or scanned. |
145 | - log.Warn(_("Error accessing possibly locked file %s") % |
146 | + log.Warn(_(u"Error accessing possibly locked file %s") % |
147 | new_path.uc_name, |
148 | log.WarningCode.cannot_read, |
149 | util.escape(new_path.name)) |
150 | @@ -197,7 +197,7 @@ |
151 | diryield_stack.append(diryield(subpath)) |
152 | |
153 | def Select(self, path): |
154 | - """Run through the selection functions and return dominant val 0/1/2""" |
155 | + u"""Run through the selection functions and return dominant val 0/1/2""" |
156 | # Only used by diryield and tests. Internal. |
157 | log.Debug(u"Selection: examining path %s" % path.uc_name) |
158 | if not self.selection_functions: |
159 | @@ -234,7 +234,7 @@ |
160 | return result |
161 | |
162 | def ParseArgs(self, argtuples, filelists): |
163 | - """Create selection functions based on list of tuples |
164 | + u"""Create selection functions based on list of tuples |
165 | |
166 | The tuples are created when the initial commandline arguments |
167 | are read. They have the form (option string, additional |
168 | @@ -246,9 +246,9 @@ |
169 | filelists_index = 0 |
170 | try: |
171 | for opt, arg in argtuples: |
172 | - assert isinstance(opt, unicode), u"option " + opt.decode(sys.getfilesystemencoding(), "ignore") + \ |
173 | + assert isinstance(opt, unicode), u"option " + opt.decode(sys.getfilesystemencoding(), u"ignore") + \ |
174 | u" is not unicode" |
175 | - assert isinstance(arg, unicode), u"option " + arg.decode(sys.getfilesystemencoding(), "ignore") + \ |
176 | + assert isinstance(arg, unicode), u"option " + arg.decode(sys.getfilesystemencoding(), u"ignore") + \ |
177 | u" is not unicode" |
178 | |
179 | if opt == u"--exclude": |
180 | @@ -287,7 +287,7 @@ |
181 | self.parse_last_excludes() |
182 | |
183 | def parse_catch_error(self, exc): |
184 | - """Deal with selection error exc""" |
185 | + u"""Deal with selection error exc""" |
186 | # Internal, used by ParseArgs. |
187 | if isinstance(exc, FilePrefixError): |
188 | log.FatalError(_(u"""\ |
189 | @@ -300,12 +300,12 @@ |
190 | (exc, self.prefix), log.ErrorCode.file_prefix_error) |
191 | elif isinstance(exc, GlobbingError): |
192 | log.FatalError(_(u"Fatal Error while processing expression\n" |
193 | - "%s") % exc, log.ErrorCode.globbing_error) |
194 | + u"%s") % exc, log.ErrorCode.globbing_error) |
195 | else: |
196 | raise # pylint: disable=misplaced-bare-raise |
197 | |
198 | def parse_last_excludes(self): |
199 | - """Exit with error if last selection function isn't an exclude""" |
200 | + u"""Exit with error if last selection function isn't an exclude""" |
201 | # Internal. Used by ParseArgs. |
202 | if (self.selection_functions and not self.selection_functions[-1].exclude): |
203 | log.FatalError(_(u"""\ |
204 | @@ -318,7 +318,7 @@ |
205 | log.ErrorCode.redundant_inclusion) |
206 | |
207 | def add_selection_func(self, sel_func, add_to_start=None): |
208 | - """Add another selection function at the end or beginning""" |
209 | + u"""Add another selection function at the end or beginning""" |
210 | # Internal. Used by ParseArgs. |
211 | if add_to_start: |
212 | self.selection_functions.insert(0, sel_func) |
213 | @@ -326,7 +326,7 @@ |
214 | self.selection_functions.append(sel_func) |
215 | |
216 | def filelist_sanitise_line(self, line, include_default): |
217 | - """ |
218 | + u""" |
219 | Sanitises lines of both normal and globbing filelists, returning (line, include) and line=None if blank/comment |
220 | |
221 | The aim is to parse filelists in a consistent way, prior to the interpretation of globbing statements. |
222 | @@ -355,7 +355,7 @@ |
223 | return line, include |
224 | |
225 | def filelist_globbing_get_sfs(self, filelist_fp, inc_default, list_name): |
226 | - """Return list of selection functions by reading fileobj |
227 | + u"""Return list of selection functions by reading fileobj |
228 | |
229 | filelist_fp should be an open file object |
230 | inc_default is true iff this is an include list |
231 | @@ -375,7 +375,7 @@ |
232 | yield self.glob_get_sf(line, include) |
233 | |
234 | def other_filesystems_get_sf(self, include): |
235 | - """Return selection function matching files on other filesystems""" |
236 | + u"""Return selection function matching files on other filesystems""" |
237 | # Internal. Used by ParseArgs and unit tests. |
238 | assert include == 0 or include == 1 |
239 | root_devloc = self.rootpath.getdevloc() |
240 | @@ -391,7 +391,7 @@ |
241 | return sel_func |
242 | |
243 | def regexp_get_sf(self, regexp_string, include): |
244 | - """Return selection function given by regexp_string""" |
245 | + u"""Return selection function given by regexp_string""" |
246 | # Internal. Used by ParseArgs and unit tests. |
247 | assert include == 0 or include == 1 |
248 | try: |
249 | @@ -411,11 +411,11 @@ |
250 | return sel_func |
251 | |
252 | def devfiles_get_sf(self): |
253 | - """Return a selection function to exclude all dev files""" |
254 | + u"""Return a selection function to exclude all dev files""" |
255 | # Internal. Used by ParseArgs. |
256 | if self.selection_functions: |
257 | log.Warn(_(u"Warning: exclude-device-files is not the first " |
258 | - "selector.\nThis may not be what you intended")) |
259 | + u"selector.\nThis may not be what you intended")) |
260 | |
261 | def sel_func(path): |
262 | if path.isdev(): |
263 | @@ -428,7 +428,7 @@ |
264 | return sel_func |
265 | |
266 | def glob_get_sf(self, glob_str, include): |
267 | - """Return selection function given by glob string""" |
268 | + u"""Return selection function given by glob string""" |
269 | # Internal. Used by ParseArgs, filelist_globbing_get_sfs and unit tests. |
270 | assert include == 0 or include == 1 |
271 | assert isinstance(glob_str, unicode) |
272 | @@ -443,7 +443,7 @@ |
273 | return sel_func |
274 | |
275 | def present_get_sf(self, filename, include): |
276 | - """Return selection function given by existence of a file in a directory""" |
277 | + u"""Return selection function given by existence of a file in a directory""" |
278 | # Internal. Used by ParseArgs. |
279 | assert include == 0 or include == 1 |
280 | |
281 | @@ -479,7 +479,7 @@ |
282 | return sel_func |
283 | |
284 | def glob_get_normal_sf(self, glob_str, include): |
285 | - """Return selection function based on glob_str |
286 | + u"""Return selection function based on glob_str |
287 | |
288 | The basic idea is to turn glob_str into a regular expression, |
289 | and just use the normal regular expression. There is a |
290 | @@ -494,13 +494,13 @@ |
291 | |
292 | """ |
293 | assert isinstance(glob_str, unicode), \ |
294 | - u"The glob string " + glob_str.decode(sys.getfilesystemencoding(), "ignore") + u" is not unicode" |
295 | + u"The glob string " + glob_str.decode(sys.getfilesystemencoding(), u"ignore") + u" is not unicode" |
296 | ignore_case = False |
297 | |
298 | - if glob_str.lower().startswith("ignorecase:"): |
299 | + if glob_str.lower().startswith(u"ignorecase:"): |
300 | # Glob string starts with ignorecase, so remove that from the |
301 | # string and change it to lowercase. |
302 | - glob_str = glob_str[len("ignorecase:"):].lower() |
303 | + glob_str = glob_str[len(u"ignorecase:"):].lower() |
304 | ignore_case = True |
305 | |
306 | # Check to make sure prefix is ok, i.e. the glob string is within |
307 | @@ -508,13 +508,13 @@ |
308 | file_prefix_selection = select_fn_from_glob(glob_str, include=1)(self.rootpath) |
309 | if not file_prefix_selection: |
310 | # file_prefix_selection == 1 (include) or 2 (scan) |
311 | - raise FilePrefixError(glob_str + " glob with " + self.rootpath.name |
312 | - + " path gives " + str(file_prefix_selection)) |
313 | + raise FilePrefixError(glob_str + u" glob with " + self.rootpath.uc_name |
314 | + + u" path gives " + unicode(file_prefix_selection)) |
315 | |
316 | return select_fn_from_glob(glob_str, include, ignore_case) |
317 | |
318 | def exclude_older_get_sf(self, date): |
319 | - """Return selection function based on files older than modification date """ |
320 | + u"""Return selection function based on files older than modification date """ |
321 | # Internal. Used by ParseArgs. |
322 | |
323 | def sel_func(path): |
324 | @@ -528,5 +528,5 @@ |
325 | return None |
326 | |
327 | sel_func.exclude = True |
328 | - sel_func.name = "Select older than %s" % (date,) |
329 | + sel_func.name = u"Select older than %s" % (date,) |
330 | return sel_func |
331 | |
332 | === modified file 'testing/functional/test_selection.py' |
333 | --- testing/functional/test_selection.py 2017-07-15 20:31:11 +0000 |
334 | +++ testing/functional/test_selection.py 2018-07-19 21:12:04 +0000 |
335 | @@ -30,7 +30,7 @@ |
336 | |
337 | |
338 | class IncludeExcludeFunctionalTest(FunctionalTestCase): |
339 | - """ |
340 | + u""" |
341 | This contains methods used in the tests below for testing the include, exclude and various filelist features. |
342 | """ |
343 | |
344 | @@ -146,7 +146,7 @@ |
345 | [u"trailing_space sub2_file.txt"]] |
346 | |
347 | def directory_tree_to_list_of_lists(self, parent_directory): |
348 | - """ |
349 | + u""" |
350 | This takes a folder as an input and returns a list with its contents. If the directory has subdirectories, it |
351 | returns a list of lists with the contents of those subdirectories. |
352 | """ |
353 | @@ -165,20 +165,20 @@ |
354 | |
355 | |
356 | class TestCheckTestFiles(IncludeExcludeFunctionalTest): |
357 | - """ Tests the testfiles required by the exclude/include tests are as expected. """ |
358 | + u""" Tests the testfiles required by the exclude/include tests are as expected. """ |
359 | |
360 | def test_files_are_as_expected(self): |
361 | - """Test that the contents of testfiles/select are as expected.""" |
362 | + u"""Test that the contents of testfiles/select are as expected.""" |
363 | testfiles = self.directory_tree_to_list_of_lists(u"testfiles/select2") |
364 | # print(testfiles) |
365 | self.assertEqual(testfiles, self.complete_directory_tree) |
366 | |
367 | |
368 | class TestIncludeExcludeOptions(IncludeExcludeFunctionalTest): |
369 | - """ This tests the behaviour of the duplicity binary when the include/exclude options are passed directly """ |
370 | + u""" This tests the behaviour of the duplicity binary when the include/exclude options are passed directly """ |
371 | |
372 | def test_include_exclude_basic(self): |
373 | - """ Test --include and --exclude work in the basic case """ |
374 | + u""" Test --include and --exclude work in the basic case """ |
375 | self.backup(u"full", u"testfiles/select2", |
376 | options=[u"--include", u"testfiles/select2/3/3sub3/3sub3sub2/3sub3sub2_file.txt", |
377 | u"--exclude", u"testfiles/select2/3/3sub3/3sub3sub2", |
378 | @@ -205,7 +205,7 @@ |
379 | self.assertEqual(restored, self.expected_restored_tree) |
380 | |
381 | def test_include_exclude_trailing_whitespace(self): |
382 | - """Test that folders with trailing whitespace in the names work correctly when passing as include/exclude""" |
383 | + u"""Test that folders with trailing whitespace in the names work correctly when passing as include/exclude""" |
384 | # Note that, because this only passes items in as a list of options, this test does not test whether duplicity |
385 | # would correctly interpret commandline options with spaces. However, bin/duplicity uses sys.argv[1:], which |
386 | # should return a list of strings after having correctly processed quotes etc. |
387 | @@ -240,12 +240,12 @@ |
388 | |
389 | |
390 | class TestExcludeFilelistTest(IncludeExcludeFunctionalTest): |
391 | - """ |
392 | + u""" |
393 | Test --exclude-filelist using duplicity binary. |
394 | """ |
395 | |
396 | def test_exclude_filelist(self): |
397 | - """Test that exclude filelist works in the basic case """ |
398 | + u"""Test that exclude filelist works in the basic case """ |
399 | # As this is an exclude filelist any lines with no +/- modifier should be treated as if they have a -. |
400 | # Create a filelist |
401 | with io.open(u"testfiles/exclude.txt", u"w") as f: |
402 | @@ -275,7 +275,7 @@ |
403 | self.assertEqual(restored, self.expected_restored_tree) |
404 | |
405 | def test_exclude_filelist_combined_imperfections(self): |
406 | - """Test that exclude filelist works with imperfections in the input file""" |
407 | + u"""Test that exclude filelist works with imperfections in the input file""" |
408 | # This is a combined test for speed reasons. The individual imperfections are tested as unittests in |
409 | # unit/test_selection. |
410 | # Imperfections tested are; |
411 | @@ -318,7 +318,7 @@ |
412 | self.assertEqual(restored, self.expected_restored_tree) |
413 | |
414 | def test_exclude_globbing_filelist_combined_imperfections(self): |
415 | - """Test that exclude globbing filelist works with imperfections in the input file""" |
416 | + u"""Test that exclude globbing filelist works with imperfections in the input file""" |
417 | # Identical to test_exclude_filelist_combined_imperfections and included to ensure that |
418 | # the deprecated --exclude-globbing-filelist function works as expected until it is deliberately removed. |
419 | # This is a combined test for speed reasons. The individual imperfections are tested as unittests in |
420 | @@ -363,7 +363,7 @@ |
421 | self.assertEqual(restored, self.expected_restored_tree) |
422 | |
423 | def test_exclude_filelist_trailing_whitespace_folders_work_with_quotes(self): |
424 | - """Test that folders with trailing whitespace in the names work correctly if they are enclosed in quotes""" |
425 | + u"""Test that folders with trailing whitespace in the names work correctly if they are enclosed in quotes""" |
426 | # Create a filelist |
427 | with io.open(u"testfiles/exclude.txt", u"w") as f: |
428 | f.write(u'+ "testfiles/select2/trailing_space /trailing_space sub2/trailing_space sub2_file.txt"\n' # New |
429 | @@ -395,7 +395,7 @@ |
430 | self.assertEqual(restored, self.expected_restored_tree_with_trailing_space) |
431 | |
432 | def test_exclude_filelist_progress_option(self): |
433 | - """Test that exclude filelist is unaffected by the --progress option""" |
434 | + u"""Test that exclude filelist is unaffected by the --progress option""" |
435 | # Regression test for Bug #1264744 (https://bugs.launchpad.net/duplicity/+bug/1264744) |
436 | # Create a filelist identical to that used in test_exclude_filelist |
437 | with io.open(u"testfiles/exclude.txt", u"w") as f: |
438 | @@ -430,12 +430,12 @@ |
439 | |
440 | |
441 | class TestIncludeFilelistTest(IncludeExcludeFunctionalTest): |
442 | - """ |
443 | + u""" |
444 | Test --include-filelist using duplicity binary. |
445 | """ |
446 | |
447 | def test_include_filelist(self): |
448 | - """Test that include filelist works in the basic case""" |
449 | + u"""Test that include filelist works in the basic case""" |
450 | # See test_exclude_filelist above for explanation of what is expected. As this is an include filelist |
451 | # any lines with no +/- modifier should be treated as if they have a +. |
452 | # Create a filelist |
453 | @@ -466,7 +466,7 @@ |
454 | self.assertEqual(restored, self.expected_restored_tree) |
455 | |
456 | def test_include_filelist_combined_imperfections(self): |
457 | - """Test that include filelist works with imperfections in the input file""" |
458 | + u"""Test that include filelist works with imperfections in the input file""" |
459 | # This is a combined test for speed reasons. The individual imperfections are tested as unittests in |
460 | # unit/test_selection. |
461 | # Imperfections tested are; |
462 | @@ -508,7 +508,7 @@ |
463 | self.assertEqual(restored, self.expected_restored_tree) |
464 | |
465 | def test_include_filelist_workaround_combined_imperfections_no_wildcards(self): |
466 | - """Test that include filelist works with imperfections in the input file""" |
467 | + u"""Test that include filelist works with imperfections in the input file""" |
468 | # This is a modified version of test_include_filelist that passes, despite Bug #1408411 |
469 | # It is still a valid test, it just does not test as many selection features as the above. |
470 | # This is a combined test for speed reasons. The individual imperfections are tested as unittests in |
471 | @@ -556,7 +556,7 @@ |
472 | self.assertEqual(restored, self.expected_restored_tree) |
473 | |
474 | def test_include_globbing_filelist_combined_imperfections(self): |
475 | - """Test that include globbing filelist works with imperfections in the input file""" |
476 | + u"""Test that include globbing filelist works with imperfections in the input file""" |
477 | # Identical to test_include_filelist_combined_imperfections and included to ensure that |
478 | # the deprecated --include-globbing-filelist function works as expected until it is deliberately removed. |
479 | # This is a combined test for speed reasons. The individual imperfections are tested as unittests in |
480 | @@ -601,11 +601,11 @@ |
481 | |
482 | |
483 | class TestIncludeExcludedForContents(IncludeExcludeFunctionalTest): |
484 | - """ Test to check that folders that are excluded are included if they contain includes of higher priority. |
485 | + u""" Test to check that folders that are excluded are included if they contain includes of higher priority. |
486 | Exhibits the issue reported in Bug #1408411 (https://bugs.launchpad.net/duplicity/+bug/1408411). """ |
487 | |
488 | def write_filelist(self, filelist_name): |
489 | - """Used by the below tests to write the filelist""" |
490 | + u"""Used by the below tests to write the filelist""" |
491 | assert filelist_name is not None |
492 | with io.open(filelist_name, u"w") as f: |
493 | f.write(u"+ testfiles/select/1/2/1\n" |
494 | @@ -614,14 +614,14 @@ |
495 | u"- testfiles/select/1/3") |
496 | |
497 | def restore_and_check(self): |
498 | - """Restores the backup and compares to what was expected (based on the filelist in write_filelist)""" |
499 | + u"""Restores the backup and compares to what was expected (based on the filelist in write_filelist)""" |
500 | self.restore() |
501 | restore_dir = u"testfiles/restore_out" |
502 | restored = self.directory_tree_to_list_of_lists(restore_dir) |
503 | self.assertEqual(restored, [[u"2"], [u"1"]]) |
504 | |
505 | def test_commandline_include_exclude(self): |
506 | - """test an excluded folder is included for included contents when using commandline includes and excludes""" |
507 | + u"""test an excluded folder is included for included contents when using commandline includes and excludes""" |
508 | self.backup(u"full", u"testfiles/select/1", |
509 | options=[u"--include", u"testfiles/select/1/2/1", |
510 | u"--exclude", u"testfiles/select/1/2", |
511 | @@ -630,28 +630,28 @@ |
512 | self.restore_and_check() |
513 | |
514 | def test_include_globbing_filelist(self): |
515 | - """test an excluded folder is included for included contents with an include-globbing-filelist """ |
516 | + u"""test an excluded folder is included for included contents with an include-globbing-filelist """ |
517 | # Deprecated, but include for now to ensure it keeps working until it is deliberately removed. |
518 | self.write_filelist(u"testfiles/include.txt") |
519 | self.backup(u"full", u"testfiles/select/1", options=[u"--include-globbing-filelist=testfiles/include.txt"]) |
520 | self.restore_and_check() |
521 | |
522 | def test_exclude_globbing_filelist(self): |
523 | - """test an excluded folder is included for included contents with an exclude-globbing-filelist """ |
524 | + u"""test an excluded folder is included for included contents with an exclude-globbing-filelist """ |
525 | # Deprecated, but include for now to ensure it keeps working until it is deliberately removed. |
526 | self.write_filelist(u"testfiles/exclude.txt") |
527 | self.backup(u"full", u"testfiles/select/1", options=[u"--exclude-globbing-filelist=testfiles/exclude.txt"]) |
528 | self.restore_and_check() |
529 | |
530 | def test_include_filelist(self): |
531 | - """test an excluded folder is included for included contents with an include-filelist (non-globbing) """ |
532 | + u"""test an excluded folder is included for included contents with an include-filelist (non-globbing) """ |
533 | # Regression test for Bug #1408411 (https://bugs.launchpad.net/duplicity/+bug/1408411) |
534 | self.write_filelist(u"testfiles/include.txt") |
535 | self.backup(u"full", u"testfiles/select/1", options=[u"--include-filelist=testfiles/include.txt"]) |
536 | self.restore_and_check() |
537 | |
538 | def test_exclude_filelist(self): |
539 | - """test an excluded folder is included for included contents with an exclude-filelist (non-globbing) """ |
540 | + u"""test an excluded folder is included for included contents with an exclude-filelist (non-globbing) """ |
541 | # Regression test for Bug #1408411 (https://bugs.launchpad.net/duplicity/+bug/1408411) |
542 | self.write_filelist(u"testfiles/exclude.txt") |
543 | self.backup(u"full", u"testfiles/select/1", options=[u"--exclude-filelist=testfiles/exclude.txt"]) |
544 | @@ -659,19 +659,19 @@ |
545 | |
546 | |
547 | class TestAsterisks(IncludeExcludeFunctionalTest): |
548 | - """ Test to check that asterisks work as expected |
549 | + u""" Test to check that asterisks work as expected |
550 | Exhibits the issue reported in Bug #884371 (https://bugs.launchpad.net/duplicity/+bug/884371). |
551 | See the unit tests for more granularity on the issue.""" |
552 | |
553 | def restore_and_check(self): |
554 | - """Restores the backup and compares to what is expected.""" |
555 | + u"""Restores the backup and compares to what is expected.""" |
556 | self.restore() |
557 | restore_dir = u"testfiles/restore_out" |
558 | restored = self.directory_tree_to_list_of_lists(restore_dir) |
559 | self.assertEqual(restored, [[u"2"], [u"1"]]) |
560 | |
561 | def test_exclude_filelist_asterisks_none(self): |
562 | - """Basic exclude filelist.""" |
563 | + u"""Basic exclude filelist.""" |
564 | with io.open(u"testfiles/filelist.txt", u"w") as f: |
565 | f.write(u"+ testfiles/select/1/2/1\n" |
566 | u"- testfiles/select/1/2\n" |
567 | @@ -681,7 +681,7 @@ |
568 | self.restore_and_check() |
569 | |
570 | def test_exclude_filelist_asterisks_single(self): |
571 | - """Exclude filelist with asterisks replacing folders.""" |
572 | + u"""Exclude filelist with asterisks replacing folders.""" |
573 | # Regression test for Bug #884371 (https://bugs.launchpad.net/duplicity/+bug/884371) |
574 | with io.open(u"testfiles/filelist.txt", u"w") as f: |
575 | f.write(u"+ */select/1/2/1\n" |
576 | @@ -692,7 +692,7 @@ |
577 | self.restore_and_check() |
578 | |
579 | def test_exclude_filelist_asterisks_double_asterisks(self): |
580 | - """Exclude filelist with double asterisks replacing folders.""" |
581 | + u"""Exclude filelist with double asterisks replacing folders.""" |
582 | # Regression test for Bug #884371 (https://bugs.launchpad.net/duplicity/+bug/884371) |
583 | with io.open(u"testfiles/filelist.txt", u"w") as f: |
584 | f.write(u"+ **/1/2/1\n" |
585 | @@ -703,7 +703,7 @@ |
586 | self.restore_and_check() |
587 | |
588 | def test_commandline_asterisks_single_excludes_only(self): |
589 | - """test_commandline_include_exclude with single asterisks on exclude lines.""" |
590 | + u"""test_commandline_include_exclude with single asterisks on exclude lines.""" |
591 | self.backup(u"full", u"testfiles/select/1", |
592 | options=[u"--include", u"testfiles/select/1/2/1", |
593 | u"--exclude", u"testfiles/*/1/2", |
594 | @@ -712,7 +712,7 @@ |
595 | self.restore_and_check() |
596 | |
597 | def test_commandline_asterisks_single_both(self): |
598 | - """test_commandline_include_exclude with single asterisks on both exclude and include lines.""" |
599 | + u"""test_commandline_include_exclude with single asterisks on both exclude and include lines.""" |
600 | # Regression test for Bug #884371 (https://bugs.launchpad.net/duplicity/+bug/884371) |
601 | self.backup(u"full", u"testfiles/select/1", |
602 | options=[u"--include", u"*/select/1/2/1", |
603 | @@ -722,7 +722,7 @@ |
604 | self.restore_and_check() |
605 | |
606 | def test_commandline_asterisks_double_exclude_only(self): |
607 | - """test_commandline_include_exclude with double asterisks on exclude lines.""" |
608 | + u"""test_commandline_include_exclude with double asterisks on exclude lines.""" |
609 | self.backup(u"full", u"testfiles/select/1", |
610 | options=[u"--include", u"testfiles/select/1/2/1", |
611 | u"--exclude", u"**/1/2", |
612 | @@ -731,7 +731,7 @@ |
613 | self.restore_and_check() |
614 | |
615 | def test_commandline_asterisks_double_both(self): |
616 | - """test_commandline_include_exclude with double asterisks on both exclude and include lines.""" |
617 | + u"""test_commandline_include_exclude with double asterisks on both exclude and include lines.""" |
618 | # Regression test for Bug #884371 (https://bugs.launchpad.net/duplicity/+bug/884371) |
619 | self.backup(u"full", u"testfiles/select/1", |
620 | options=[u"--include", u"**/1/2/1", |
621 | @@ -741,7 +741,7 @@ |
622 | self.restore_and_check() |
623 | |
624 | def test_single_and_double_asterisks(self): |
625 | - """This compares a backup using --include-globbing-filelist with a single and double *.""" |
626 | + u"""This compares a backup using --include-globbing-filelist with a single and double *.""" |
627 | with io.open(u"testfiles/filelist.txt", u"w") as f: |
628 | f.write(u"+ testfiles/select2/*\n" |
629 | u"- testfiles/select") |
630 | @@ -759,7 +759,7 @@ |
631 | self.assertEqual(restored, restored2) |
632 | |
633 | def test_single_and_double_asterisks_includes_excludes(self): |
634 | - """This compares a backup using --includes/--excludes with a single and double *.""" |
635 | + u"""This compares a backup using --includes/--excludes with a single and double *.""" |
636 | self.backup(u"full", u"testfiles/", |
637 | options=[u"--include", u"testfiles/select2/*", |
638 | u"--exclude", u"testfiles/select"]) |
639 | @@ -776,18 +776,18 @@ |
640 | |
641 | |
642 | class TestTrailingSlash(IncludeExcludeFunctionalTest): |
643 | - """ Test to check that a trailing slash works as expected |
644 | + u""" Test to check that a trailing slash works as expected |
645 | Exhibits the issue reported in Bug #932482 (https://bugs.launchpad.net/duplicity/+bug/932482).""" |
646 | |
647 | def restore_and_check(self): |
648 | - """Restores the backup and compares to what is expected.""" |
649 | + u"""Restores the backup and compares to what is expected.""" |
650 | self.restore() |
651 | restore_dir = u"testfiles/restore_out" |
652 | restored = self.directory_tree_to_list_of_lists(restore_dir) |
653 | self.assertEqual(restored, [[u"2"], [u"1"]]) |
654 | |
655 | def test_exclude_filelist_trailing_slashes(self): |
656 | - """test_exclude_filelist_asterisks_none with trailing slashes.""" |
657 | + u"""test_exclude_filelist_asterisks_none with trailing slashes.""" |
658 | with io.open(u"testfiles/filelist.txt", u"w") as f: |
659 | f.write(u"+ testfiles/select/1/2/1/\n" |
660 | u"- testfiles/select/1/2/\n" |
661 | @@ -797,7 +797,7 @@ |
662 | self.restore_and_check() |
663 | |
664 | def test_exclude_filelist_trailing_slashes_single_wildcards_excludes(self): |
665 | - """test_exclude_filelist_trailing_slashes with single wildcards in excludes.""" |
666 | + u"""test_exclude_filelist_trailing_slashes with single wildcards in excludes.""" |
667 | # Regression test for Bug #932482 (https://bugs.launchpad.net/duplicity/+bug/932482) |
668 | with io.open(u"testfiles/filelist.txt", u"w") as f: |
669 | f.write(u"+ testfiles/select/1/2/1/\n" |
670 | @@ -808,7 +808,7 @@ |
671 | self.restore_and_check() |
672 | |
673 | def test_exclude_filelist_trailing_slashes_double_wildcards_excludes(self): |
674 | - """test_exclude_filelist_trailing_slashes with double wildcards in excludes.""" |
675 | + u"""test_exclude_filelist_trailing_slashes with double wildcards in excludes.""" |
676 | # Regression test for Bug #932482 (https://bugs.launchpad.net/duplicity/+bug/932482) |
677 | with io.open(u"testfiles/filelist.txt", u"w") as f: |
678 | f.write(u"+ testfiles/select/1/2/1/\n" |
679 | @@ -819,7 +819,7 @@ |
680 | self.restore_and_check() |
681 | |
682 | def test_exclude_filelist_trailing_slashes_double_wildcards_excludes_2(self): |
683 | - """second test_exclude_filelist_trailing_slashes with double wildcards in excludes.""" |
684 | + u"""second test_exclude_filelist_trailing_slashes with double wildcards in excludes.""" |
685 | # Regression test for Bug #932482 (https://bugs.launchpad.net/duplicity/+bug/932482) and |
686 | # Regression test for Bug #884371 (https://bugs.launchpad.net/duplicity/+bug/884371) |
687 | with io.open(u"testfiles/filelist.txt", u"w") as f: |
688 | @@ -831,7 +831,7 @@ |
689 | self.restore_and_check() |
690 | |
691 | def test_exclude_filelist_trailing_slashes_wildcards(self): |
692 | - """test_commandline_asterisks_single_excludes_only with trailing slashes.""" |
693 | + u"""test_commandline_asterisks_single_excludes_only with trailing slashes.""" |
694 | # Regression test for Bug #932482 (https://bugs.launchpad.net/duplicity/+bug/932482) |
695 | self.backup(u"full", u"testfiles/select/1", |
696 | options=[u"--include", u"testfiles/select/1/2/1/", |
697 | @@ -842,11 +842,11 @@ |
698 | |
699 | |
700 | class TestTrailingSlash2(IncludeExcludeFunctionalTest): |
701 | - """ This tests the behaviour of globbing strings with a trailing slash""" |
702 | + u""" This tests the behaviour of globbing strings with a trailing slash""" |
703 | # See Bug #1479545 (https://bugs.launchpad.net/duplicity/+bug/1479545) |
704 | |
705 | def test_no_trailing_slash(self): |
706 | - """ Test that including 1.py works as expected""" |
707 | + u""" Test that including 1.py works as expected""" |
708 | self.backup(u"full", u"testfiles/select2", |
709 | options=[u"--include", u"testfiles/select2/1.py", |
710 | u"--exclude", u"**"]) |
711 | @@ -856,7 +856,7 @@ |
712 | self.assertEqual(restored, [[u"1.py"]]) |
713 | |
714 | def test_trailing_slash(self): |
715 | - """ Test that globs with a trailing slash only match directories""" |
716 | + u""" Test that globs with a trailing slash only match directories""" |
717 | # Regression test for Bug #1479545 |
718 | # (https://bugs.launchpad.net/duplicity/+bug/1479545) |
719 | self.backup(u"full", u"testfiles/select2", |
720 | @@ -868,7 +868,7 @@ |
721 | self.assertEqual(restored, []) |
722 | |
723 | def test_include_files_not_subdirectories(self): |
724 | - """ Test that a trailing slash glob followed by a * glob only matches |
725 | + u""" Test that a trailing slash glob followed by a * glob only matches |
726 | files and not subdirectories""" |
727 | self.backup(u"full", u"testfiles/select2", |
728 | options=[u"--exclude", u"testfiles/select2/*/", |
729 | @@ -880,7 +880,7 @@ |
730 | self.assertEqual(restored, [[u"1.doc", u"1.py"]]) |
731 | |
732 | def test_include_subdirectories_not_files(self): |
733 | - """ Test that a trailing slash glob only matches directories""" |
734 | + u""" Test that a trailing slash glob only matches directories""" |
735 | self.backup(u"full", u"testfiles/select2", |
736 | options=[u"--include", u"testfiles/select2/1/1sub1/**/", |
737 | u"--exclude", u"testfiles/select2/1/1sub1/**", |
738 | @@ -893,7 +893,7 @@ |
739 | |
740 | |
741 | class TestGlobbingReplacement(IncludeExcludeFunctionalTest): |
742 | - """ This tests the behaviour of the extended shell globbing pattern replacement functions.""" |
743 | + u""" This tests the behaviour of the extended shell globbing pattern replacement functions.""" |
744 | # See the manual for a description of behaviours, but in summary: |
745 | # * can be expanded to any string of characters not containing "/" |
746 | # ? expands to any character except "/" and |
747 | @@ -903,7 +903,7 @@ |
748 | # removed and any character in the string can be replaced with an upper- or lowercase version of itself. |
749 | |
750 | def test_globbing_replacement_in_includes(self): |
751 | - """ Test behaviour of the extended shell globbing pattern replacement functions in both include and exclude""" |
752 | + u""" Test behaviour of the extended shell globbing pattern replacement functions in both include and exclude""" |
753 | # Identical to test_include_exclude_basic with globbing characters added to both include and exclude lines |
754 | # Exhibits the issue reported in Bug #884371 (https://bugs.launchpad.net/duplicity/+bug/884371). |
755 | # See above and the unit tests for more granularity on the issue. |
756 | @@ -931,10 +931,10 @@ |
757 | |
758 | |
759 | class TestExcludeIfPresent(IncludeExcludeFunctionalTest): |
760 | - """ This tests the behaviour of duplicity's --exclude-if-present option""" |
761 | + u""" This tests the behaviour of duplicity's --exclude-if-present option""" |
762 | |
763 | def test_exclude_if_present_baseline(self): |
764 | - """ Test that duplicity normally backs up files""" |
765 | + u""" Test that duplicity normally backs up files""" |
766 | with io.open(u"testfiles/select2/1/1sub1/1sub1sub1/.nobackup", u"w") as tag: |
767 | tag.write(u"Files in this folder should not be backed up.") |
768 | self.backup(u"full", u"testfiles/select2/1/1sub1", |
769 | @@ -947,7 +947,7 @@ |
770 | [u".nobackup", u"1sub1sub1_file.txt"]]) |
771 | |
772 | def test_exclude_if_present_excludes(self): |
773 | - """ Test that duplicity excludes files with relevant tag""" |
774 | + u""" Test that duplicity excludes files with relevant tag""" |
775 | with io.open(u"testfiles/select2/1/1sub1/1sub1sub1/.nobackup", u"w") as tag: |
776 | tag.write(u"Files in this folder should not be backed up.") |
777 | self.backup(u"full", u"testfiles/select2/1/1sub1", |
778 | @@ -960,7 +960,7 @@ |
779 | self.assertEqual(restored, []) |
780 | |
781 | def test_exclude_if_present_excludes_2(self): |
782 | - """ Test that duplicity excludes files with relevant tag""" |
783 | + u""" Test that duplicity excludes files with relevant tag""" |
784 | with io.open(u"testfiles/select2/1/1sub1/1sub1sub1/EXCLUDE.tag", u"w") as tag: |
785 | tag.write(u"Files in this folder should also not be backed up.") |
786 | self.backup(u"full", u"testfiles/select2/1/1sub1", |
787 | @@ -974,12 +974,12 @@ |
788 | |
789 | |
790 | class TestLockedFoldersNoError(IncludeExcludeFunctionalTest): |
791 | - """ This tests that inaccessible folders do not cause an error""" |
792 | + u""" This tests that inaccessible folders do not cause an error""" |
793 | |
794 | - @unittest.skipUnless(platform.platform().startswith("Linux"), |
795 | + @unittest.skipUnless(platform.platform().startswith(u"Linux"), |
796 | u"Skip on non-Linux systems") |
797 | def test_locked_baseline(self): |
798 | - """ Test no error if locked in path but excluded""" |
799 | + u""" Test no error if locked in path but excluded""" |
800 | folder_to_lock = u"testfiles/select2/1/1sub1/1sub1sub3" |
801 | initial_mode = os.stat(folder_to_lock).st_mode |
802 | os.chmod(folder_to_lock, 0o0000) |
803 | @@ -993,10 +993,10 @@ |
804 | self.assertEqual(restored, [[u"1sub1sub1"], |
805 | [u"1sub1sub1_file.txt"]]) |
806 | |
807 | - @unittest.skipUnless(platform.platform().startswith("Linux"), |
808 | + @unittest.skipUnless(platform.platform().startswith(u"Linux"), |
809 | u"Skip on non-Linux systems") |
810 | def test_locked_excl_if_present(self): |
811 | - """ Test no error if excluded locked with --exclude-if-present""" |
812 | + u""" Test no error if excluded locked with --exclude-if-present""" |
813 | # Regression test for Bug #1620085 |
814 | # https://bugs.launchpad.net/duplicity/+bug/1620085 |
815 | folder_to_lock = u"testfiles/select2/1/1sub1/1sub1sub3" |
816 | @@ -1015,11 +1015,11 @@ |
817 | |
818 | |
819 | class TestFolderIncludesFiles(IncludeExcludeFunctionalTest): |
820 | - """ This tests that including a folder includes the files within it""" |
821 | + u""" This tests that including a folder includes the files within it""" |
822 | # https://bugs.launchpad.net/duplicity/+bug/1624725 |
823 | |
824 | def test_includes_files(self): |
825 | - """This tests that including a folder includes the files within it""" |
826 | + u"""This tests that including a folder includes the files within it""" |
827 | self.backup(u"full", u"testfiles/select2/1/1sub1", |
828 | options=[u"--include", u"testfiles/select2/1/1sub1/1sub1sub1", |
829 | u"--exclude", u"**"]) |
830 | @@ -1030,7 +1030,7 @@ |
831 | [u"1sub1sub1_file.txt"]]) |
832 | |
833 | def test_includes_files_trailing_slash(self): |
834 | - """This tests that including a folder includes the files within it""" |
835 | + u"""This tests that including a folder includes the files within it""" |
836 | self.backup(u"full", u"testfiles/select2/1/1sub1", |
837 | options=[u"--include", u"testfiles/select2/1/1sub1/1sub1sub1/", |
838 | u"--exclude", u"**"]) |
839 | @@ -1041,7 +1041,7 @@ |
840 | [u"1sub1sub1_file.txt"]]) |
841 | |
842 | def test_includes_files_trailing_slash_globbing_chars(self): |
843 | - """Tests folder includes with globbing char and /""" |
844 | + u"""Tests folder includes with globbing char and /""" |
845 | self.backup(u"full", u"testfiles/select2/1/1sub1", |
846 | options=[u"--include", u"testfiles/s?lect2/1/1sub1/1sub1sub1/", |
847 | u"--exclude", u"**"]) |
848 | @@ -1052,7 +1052,7 @@ |
849 | [u"1sub1sub1_file.txt"]]) |
850 | |
851 | def test_excludes_files_no_trailing_slash(self): |
852 | - """This tests that excluding a folder excludes the files within it""" |
853 | + u"""This tests that excluding a folder excludes the files within it""" |
854 | self.backup(u"full", u"testfiles/select2/1/1sub1", |
855 | options=[u"--exclude", u"testfiles/select2/1/1sub1/1sub1sub1", |
856 | u"--exclude", u"testfiles/select2/1/1sub1/1sub1sub2", |
857 | @@ -1065,7 +1065,7 @@ |
858 | self.assertEqual(restored, []) |
859 | |
860 | def test_excludes_files_trailing_slash(self): |
861 | - """Excluding a folder excludes the files within it, if ends with /""" |
862 | + u"""Excluding a folder excludes the files within it, if ends with /""" |
863 | self.backup(u"full", u"testfiles/select2/1/1sub1", |
864 | options=[u"--exclude", u"testfiles/select2/1/1sub1/1sub1sub1/", |
865 | u"--exclude", u"testfiles/select2/1/1sub1/1sub1sub2/", |
866 | @@ -1078,7 +1078,7 @@ |
867 | self.assertEqual(restored, []) |
868 | |
869 | def test_excludes_files_trailing_slash_globbing_chars(self): |
870 | - """Tests folder excludes with globbing char and /""" |
871 | + u"""Tests folder excludes with globbing char and /""" |
872 | self.backup(u"full", u"testfiles/select2/1/1sub1", |
873 | options=[u"--exclude", u"testfiles/sel?ct2/1/1sub1/1sub1sub1/", |
874 | u"--exclude", u"testfiles/sel[e,f]ct2/1/1sub1/1sub1sub2/", |
875 | @@ -1092,10 +1092,10 @@ |
876 | |
877 | |
878 | class TestAbsolutePaths(IncludeExcludeFunctionalTest): |
879 | - """ Tests include/exclude options with absolute paths""" |
880 | + u""" Tests include/exclude options with absolute paths""" |
881 | |
882 | def test_absolute_paths_non_globbing(self): |
883 | - """ Test --include and --exclude work with absolute paths""" |
884 | + u""" Test --include and --exclude work with absolute paths""" |
885 | self.backup(u"full", os.path.abspath(u"testfiles/select2"), |
886 | options=[u"--include", os.path.abspath(u"testfiles/select2/3/3sub3/3sub3sub2/3sub3sub2_file.txt"), |
887 | u"--exclude", os.path.abspath(u"testfiles/select2/3/3sub3/3sub3sub2"), |
888 | @@ -1122,13 +1122,13 @@ |
889 | self.assertEqual(restored, self.expected_restored_tree) |
890 | |
891 | |
892 | -@unittest.skipUnless(sys.getfilesystemencoding() == "UTF-8", |
893 | +@unittest.skipUnless(sys.getfilesystemencoding() == u"UTF-8", |
894 | u"Skipping TestUnicode -- Only tested to work on UTF-8 systems") |
895 | class TestUnicode(IncludeExcludeFunctionalTest): |
896 | - """ Tests include/exclude options with unicode paths""" |
897 | + u""" Tests include/exclude options with unicode paths""" |
898 | |
899 | def test_unicode_paths_non_globbing(self): |
900 | - """ Test --include and --exclude work with unicode paths""" |
901 | + u""" Test --include and --exclude work with unicode paths""" |
902 | self.backup(u"full", u"testfiles/select-unicode", |
903 | options=[u"--exclude", u"testfiles/select-unicode/прыклад/пример/例/Παράδειγμα/उदाहरण.txt", |
904 | u"--exclude", u"testfiles/select-unicode/прыклад/пример/例/Παράδειγμα/דוגמא.txt", |
905 | @@ -1145,7 +1145,7 @@ |
906 | [u"пример", u"উদাহরণ"], [u"例"], [u"Παράδειγμα"], [u"ઉદાહરણ.log"]]) |
907 | |
908 | def test_unicode_paths_asterisks(self): |
909 | - """ Test --include and --exclude work with unicode paths and globs containing * and **""" |
910 | + u""" Test --include and --exclude work with unicode paths and globs containing * and **""" |
911 | p = u"testfiles/select-unicode/" |
912 | self.backup(u"full", u"testfiles/select-unicode", |
913 | options=[u"--exclude", p + u"прыклад/пример/例/Παρά*ειγμα/उदाहरण.txt", # Note * |
914 | @@ -1163,7 +1163,7 @@ |
915 | [u"пример", u"উদাহরণ"], [u"例"], [u"Παράδειγμα"], [u"ઉદાહરણ.log"]]) |
916 | |
917 | def test_unicode_paths_square_brackets(self): |
918 | - """ Test --include and --exclude work with unicode paths with character options in []s and [!]s""" |
919 | + u""" Test --include and --exclude work with unicode paths with character options in []s and [!]s""" |
920 | p = u"testfiles/select-unicode/" |
921 | self.backup(u"full", u"testfiles/select-unicode", |
922 | options=[u"--exclude", p + u"прыклад/пример/例/Παράδειγμα/उदाहरण.txt", |
923 | @@ -1181,11 +1181,11 @@ |
924 | [u"пример", u"উদাহরণ"], [u"例"], [u"Παράδειγμα"], [u"ઉદાહરણ.log"]]) |
925 | |
926 | def test_unicode_filelist(self): |
927 | - """Test that exclude filelist works with unicode filenames""" |
928 | + u"""Test that exclude filelist works with unicode filenames""" |
929 | # As this is an exclude filelist any lines with no +/- modifier should be treated as if they have a -. |
930 | path = u"testfiles/select-unicode/" |
931 | # Create a filelist |
932 | - with io.open(u"testfiles/exclude.txt", u"w", encoding="UTF-8") as f: |
933 | + with io.open(u"testfiles/exclude.txt", u"w", encoding=u"UTF-8") as f: |
934 | f.write(u"- " + path + u"прыклад/пример/例/Παράδειγμα/उदाहरण.txt\n" |
935 | u"- " + path + u"прыклад/пример/例/Παράδειγμα/דוגמא.txt\n" |
936 | u"- " + path + u"прыклад/пример/例/მაგალითი/\n" |
937 | @@ -1201,5 +1201,5 @@ |
938 | self.assertEqual(restored, [[u"прыклад", u"օրինակ.txt"], |
939 | [u"пример", u"উদাহরণ"], [u"例"], [u"Παράδειγμα"], [u"ઉદાહરણ.log"]]) |
940 | |
941 | -if __name__ == "__main__": |
942 | +if __name__ == u"__main__": |
943 | unittest.main() |
944 | |
945 | === modified file 'testing/test_code.py' |
946 | --- testing/test_code.py 2018-06-08 16:39:57 +0000 |
947 | +++ testing/test_code.py 2018-07-19 21:12:04 +0000 |
948 | @@ -161,7 +161,6 @@ |
949 | os.path.join(_top_dir, u'duplicity', u'file_naming.py'), |
950 | os.path.join(_top_dir, u'duplicity', u'filechunkio.py'), |
951 | os.path.join(_top_dir, u'duplicity', u'globals.py'), |
952 | - os.path.join(_top_dir, u'duplicity', u'globmatch.py'), |
953 | os.path.join(_top_dir, u'duplicity', u'gpg.py'), |
954 | os.path.join(_top_dir, u'duplicity', u'gpginterface.py'), |
955 | os.path.join(_top_dir, u'duplicity', u'lazy.py'), |
956 | @@ -172,7 +171,6 @@ |
957 | os.path.join(_top_dir, u'duplicity', u'path.py'), |
958 | os.path.join(_top_dir, u'duplicity', u'progress.py'), |
959 | os.path.join(_top_dir, u'duplicity', u'robust.py'), |
960 | - os.path.join(_top_dir, u'duplicity', u'selection.py'), |
961 | os.path.join(_top_dir, u'duplicity', u'statistics.py'), |
962 | os.path.join(_top_dir, u'duplicity', u'tarfile.py'), |
963 | os.path.join(_top_dir, u'duplicity', u'tempdir.py'), |
964 | @@ -187,7 +185,6 @@ |
965 | os.path.join(_top_dir, u'testing', u'functional', u'test_rdiffdir.py'), |
966 | os.path.join(_top_dir, u'testing', u'functional', u'test_replicate.py'), |
967 | os.path.join(_top_dir, u'testing', u'functional', u'test_restart.py'), |
968 | - os.path.join(_top_dir, u'testing', u'functional', u'test_selection.py'), |
969 | os.path.join(_top_dir, u'testing', u'functional', u'test_verify.py'), |
970 | os.path.join(_top_dir, u'testing', u'manual', u'__init__.py'), |
971 | os.path.join(_top_dir, u'testing', u'overrides', u'__init__.py'), |
972 | @@ -201,14 +198,12 @@ |
973 | os.path.join(_top_dir, u'testing', u'unit', u'test_dup_temp.py'), |
974 | os.path.join(_top_dir, u'testing', u'unit', u'test_dup_time.py'), |
975 | os.path.join(_top_dir, u'testing', u'unit', u'test_file_naming.py'), |
976 | - os.path.join(_top_dir, u'testing', u'unit', u'test_globmatch.py'), |
977 | os.path.join(_top_dir, u'testing', u'unit', u'test_gpg.py'), |
978 | os.path.join(_top_dir, u'testing', u'unit', u'test_gpginterface.py'), |
979 | os.path.join(_top_dir, u'testing', u'unit', u'test_lazy.py'), |
980 | os.path.join(_top_dir, u'testing', u'unit', u'test_manifest.py'), |
981 | os.path.join(_top_dir, u'testing', u'unit', u'test_patchdir.py'), |
982 | os.path.join(_top_dir, u'testing', u'unit', u'test_path.py'), |
983 | - os.path.join(_top_dir, u'testing', u'unit', u'test_selection.py'), |
984 | os.path.join(_top_dir, u'testing', u'unit', u'test_statistics.py'), |
985 | os.path.join(_top_dir, u'testing', u'unit', u'test_tarfile.py'), |
986 | os.path.join(_top_dir, u'testing', u'unit', u'test_tempdir.py')] |
987 | |
988 | === modified file 'testing/unit/test_globmatch.py' |
989 | --- testing/unit/test_globmatch.py 2017-07-15 20:31:11 +0000 |
990 | +++ testing/unit/test_globmatch.py 2018-07-19 21:12:04 +0000 |
991 | @@ -30,7 +30,7 @@ |
992 | |
993 | |
994 | def sel_file(glob_str, include, file_path): |
995 | - """Returns the selection value for file_path, given the include value, |
996 | + u"""Returns the selection value for file_path, given the include value, |
997 | returning: |
998 | 0 - if the file should be excluded |
999 | 1 - if the file should be included |
1000 | @@ -45,39 +45,39 @@ |
1001 | |
1002 | |
1003 | def inc_sel_file(glob_str, file_path): |
1004 | - """Returns result of sel_file with include value set to 1""" |
1005 | + u"""Returns result of sel_file with include value set to 1""" |
1006 | # Aids readability of the testing code to only have one number (the |
1007 | # result of the select function) |
1008 | return sel_file(glob_str, 1, file_path) |
1009 | |
1010 | |
1011 | def exc_sel_file(glob_str, file_path): |
1012 | - """Returns result of sel_file with include value set to 0""" |
1013 | + u"""Returns result of sel_file with include value set to 0""" |
1014 | return sel_file(glob_str, 0, file_path) |
1015 | |
1016 | |
1017 | def sel_dir(glob_str, include, file_path): |
1018 | - """As per sel_file, but mocks file_path to be a directory""" |
1019 | - with patch('duplicity.path.Path.isdir') as mock_isdir: |
1020 | + u"""As per sel_file, but mocks file_path to be a directory""" |
1021 | + with patch(u'duplicity.path.Path.isdir') as mock_isdir: |
1022 | mock_isdir.return_value = True |
1023 | return sel_file(glob_str, include, file_path) |
1024 | |
1025 | |
1026 | def inc_sel_dir(glob_str, file_path): |
1027 | - """Returns result of sel_dir with include value set to 1""" |
1028 | + u"""Returns result of sel_dir with include value set to 1""" |
1029 | return sel_dir(glob_str, 1, file_path) |
1030 | |
1031 | |
1032 | def exc_sel_dir(glob_str, file_path): |
1033 | - """Returns result of sel_dir with include value set to 0""" |
1034 | + u"""Returns result of sel_dir with include value set to 0""" |
1035 | return sel_dir(glob_str, 0, file_path) |
1036 | |
1037 | |
1038 | class TestGlobToRegex(UnitTestCase): |
1039 | - """Test translation of glob strings into regular expressions""" |
1040 | + u"""Test translation of glob strings into regular expressions""" |
1041 | |
1042 | def test_glob_to_regex(self): |
1043 | - """test_glob_re - test translation of shell pattern to regular exp""" |
1044 | + u"""test_glob_re - test translation of shell pattern to regular exp""" |
1045 | self.assertEqual(glob_to_regex(u"hello"), u"hello") |
1046 | self.assertEqual(glob_to_regex(u".e?ll**o"), u"\\.e[^/]ll.*o") |
1047 | self.assertEqual(glob_to_regex(u"[abc]el[^de][!fg]h"), |
1048 | @@ -89,22 +89,22 @@ |
1049 | |
1050 | |
1051 | class TestSelectValuesFromGlobs(UnitTestCase): |
1052 | - """Test the select values returned from various globs""" |
1053 | + u"""Test the select values returned from various globs""" |
1054 | |
1055 | def test_glob_scans_parent_directories(self): |
1056 | - """Test glob scans parent""" |
1057 | + u"""Test glob scans parent""" |
1058 | self.assertEqual( |
1059 | inc_sel_dir(u"testfiles/parent/sub", u"testfiles/parent"), 2) |
1060 | self.assertEqual( |
1061 | inc_sel_dir(u"testfiles/select2/3/3sub2", u"testfiles/select2/3"), 2) |
1062 | |
1063 | def test_double_asterisk_include(self): |
1064 | - """Test a few globbing patterns, including **""" |
1065 | + u"""Test a few globbing patterns, including **""" |
1066 | self.assertEqual(inc_sel_file(u"**", u"foo.txt"), 1) |
1067 | self.assertEqual(inc_sel_dir(u"**", u"folder"), 1) |
1068 | |
1069 | def test_double_asterisk_extension_include(self): |
1070 | - """Test **.py""" |
1071 | + u"""Test **.py""" |
1072 | self.assertEqual(inc_sel_file(u"**.py", u"what/ever.py"), 1) |
1073 | self.assertEqual(inc_sel_file(u"**.py", u"what/ever.py/foo"), 1) |
1074 | self.assertEqual(inc_sel_dir(u"**.py", u"foo"), 2) |
1075 | @@ -113,10 +113,10 @@ |
1076 | |
1077 | |
1078 | class TestTrailingSlash(UnitTestCase): |
1079 | - """Test glob matching where the glob has a trailing slash""" |
1080 | + u"""Test glob matching where the glob has a trailing slash""" |
1081 | |
1082 | def test_trailing_slash_matches_only_dirs(self): |
1083 | - """Test matching where glob includes a trailing slash""" |
1084 | + u"""Test matching where glob includes a trailing slash""" |
1085 | # Test the folder named "folder" is included |
1086 | self.assertEqual(inc_sel_dir(u"fold*/", u"folder"), 1) |
1087 | |
1088 | @@ -128,24 +128,24 @@ |
1089 | self.assertEqual(inc_sel_file(u"fo*/", u"foo.txt"), None) |
1090 | |
1091 | def test_included_files_are_matched_no_slash(self): |
1092 | - """Test that files within an included folder are matched""" |
1093 | + u"""Test that files within an included folder are matched""" |
1094 | self.assertEqual(inc_sel_file(u"fold*", u"folder/file.txt"), 1) |
1095 | self.assertEqual(inc_sel_file(u"fold*", u"folder/file.txt"), 1) |
1096 | self.assertEqual(inc_sel_file(u"fold*", u"folder/2/file.txt"), 1) |
1097 | |
1098 | def test_included_files_are_matched_no_slash_2(self): |
1099 | - """Test that files within an included folder are matched""" |
1100 | + u"""Test that files within an included folder are matched""" |
1101 | self.assertEqual(inc_sel_file(u"folder", u"folder/file.txt"), 1) |
1102 | self.assertEqual(inc_sel_file(u"folder/2", u"folder/2/file.txt"), 1) |
1103 | |
1104 | def test_included_files_are_matched_slash(self): |
1105 | - """Test that files within an included folder are matched with /""" |
1106 | + u"""Test that files within an included folder are matched with /""" |
1107 | # Bug #1624725 |
1108 | # https://bugs.launchpad.net/duplicity/+bug/1624725 |
1109 | self.assertEqual(inc_sel_file(u"folder/", u"folder/file.txt"), 1) |
1110 | |
1111 | def test_included_files_are_matched_slash_2(self): |
1112 | - """Test that files within an included folder are matched with /""" |
1113 | + u"""Test that files within an included folder are matched with /""" |
1114 | # Bug #1624725 |
1115 | # https://bugs.launchpad.net/duplicity/+bug/1624725 |
1116 | self.assertEqual(inc_sel_file( |
1117 | @@ -153,7 +153,7 @@ |
1118 | u"testfiles/select2/1/1sub1/1sub1sub1/1sub1sub1_file.txt"), 1) |
1119 | |
1120 | def test_included_files_are_matched_slash_2_parents(self): |
1121 | - """Test that duplicity will scan parent of glob/""" |
1122 | + u"""Test that duplicity will scan parent of glob/""" |
1123 | # Bug #1624725 |
1124 | # https://bugs.launchpad.net/duplicity/+bug/1624725 |
1125 | self.assertEqual(inc_sel_dir( |
1126 | @@ -164,13 +164,13 @@ |
1127 | u"testfiles/select2/1/1sub1"), 2) |
1128 | |
1129 | def test_included_files_are_matched_slash_wildcard(self): |
1130 | - """Test that files within an included folder are matched with /""" |
1131 | + u"""Test that files within an included folder are matched with /""" |
1132 | # Bug #1624725 |
1133 | # https://bugs.launchpad.net/duplicity/+bug/1624725 |
1134 | self.assertEqual(inc_sel_file(u"fold*/", u"folder/file.txt"), 1) |
1135 | |
1136 | def test_slash_matches_everything(self): |
1137 | - """Test / matches everything""" |
1138 | + u"""Test / matches everything""" |
1139 | self.assertEqual(inc_sel_dir(u"/", u"/tmp/testfiles/select/1/2"), 1) |
1140 | self.assertEqual(inc_sel_dir(u"/", u"/test/random/path"), 1) |
1141 | self.assertEqual(exc_sel_dir(u"/", u"/test/random/path"), 0) |
1142 | @@ -179,45 +179,45 @@ |
1143 | self.assertEqual(inc_sel_file(u"/", u"/var/log/log.txt"), 1) |
1144 | |
1145 | def test_slash_star_scans_folder(self): |
1146 | - """Test that folder/* scans folder/""" |
1147 | + u"""Test that folder/* scans folder/""" |
1148 | # This behaviour is a bit ambiguous - either include or scan could be |
1149 | # argued as most appropriate here, but only an empty folder is at stake |
1150 | # so long as test_slash_star_includes_folder_contents passes. |
1151 | self.assertEqual(inc_sel_dir(u"folder/*", u"folder"), 2) |
1152 | |
1153 | def test_slash_star_includes_folder_contents(self): |
1154 | - """Test that folder/* includes folder contents""" |
1155 | + u"""Test that folder/* includes folder contents""" |
1156 | self.assertEqual(inc_sel_file(u"folder/*", u"folder/file.txt"), 1) |
1157 | self.assertEqual(inc_sel_file(u"folder/*", u"folder/other_file.log"), 1) |
1158 | |
1159 | def test_slash_star_star_scans_folder(self): |
1160 | - """Test that folder/** scans folder/""" |
1161 | + u"""Test that folder/** scans folder/""" |
1162 | self.assertEqual(inc_sel_dir(u"folder/**", u"folder"), 2) |
1163 | |
1164 | def test_simple_trailing_slash_match(self): |
1165 | - """Test that a normal folder string ending in / matches that path""" |
1166 | + u"""Test that a normal folder string ending in / matches that path""" |
1167 | self.assertEqual(inc_sel_dir(u"testfiles/select/1/2/1/", |
1168 | u"testfiles/select/1/2/1"), 1) |
1169 | |
1170 | def test_double_asterisk_string_slash(self): |
1171 | - """Test string starting with ** and ending in /""" |
1172 | + u"""Test string starting with ** and ending in /""" |
1173 | self.assertEqual(inc_sel_dir(u"**/1/2/", u"testfiles/select/1/2"), 1) |
1174 | |
1175 | def test_string_double_asterisk_string_slash(self): |
1176 | - """Test string ** string /""" |
1177 | + u"""Test string ** string /""" |
1178 | self.assertEqual(inc_sel_dir(u"testfiles**/2/", |
1179 | u"testfiles/select/1/2"), 1) |
1180 | |
1181 | |
1182 | class TestDoubleAsterisk(UnitTestCase): |
1183 | - """Test glob matching where the glob finishes with a **""" |
1184 | + u"""Test glob matching where the glob finishes with a **""" |
1185 | |
1186 | def test_double_asterisk_no_match(self): |
1187 | - """Test that a folder string ending /** does not match other paths""" |
1188 | + u"""Test that a folder string ending /** does not match other paths""" |
1189 | self.assertEqual(inc_sel_dir(u"/test/folder/**", u"/test/foo"), None) |
1190 | |
1191 | def test_double_asterisk_match(self): |
1192 | - """Test that a folder string ending in /** matches that path""" |
1193 | + u"""Test that a folder string ending in /** matches that path""" |
1194 | self.assertEqual(inc_sel_dir(u"/test/folder/**", |
1195 | u"/test/folder/foo"), 1) |
1196 | self.assertEqual(inc_sel_file(u"/test/folder/**", |
1197 | @@ -228,24 +228,24 @@ |
1198 | u"/test/folder/2/foo.txt"), 1) |
1199 | |
1200 | def test_asterisk_slash_double_asterisk(self): |
1201 | - """Test folder string ending in */**""" |
1202 | + u"""Test folder string ending in */**""" |
1203 | self.assertEqual(inc_sel_dir(u"fold*/**", u"folder"), 2) |
1204 | |
1205 | |
1206 | class TestSimpleUnicode(UnitTestCase): |
1207 | - """Test simple unicode comparison""" |
1208 | + u"""Test simple unicode comparison""" |
1209 | |
1210 | def test_simple_unicode(self): |
1211 | - """Test simple unicode comparison""" |
1212 | + u"""Test simple unicode comparison""" |
1213 | self.assertEqual(inc_sel_file(u"прыклад/пример/例/Παράδειγμα/उदाहरण.txt", |
1214 | u"прыклад/пример/例/Παράδειγμα/उदाहरण.txt"), 1) |
1215 | |
1216 | |
1217 | class TestSquareBrackets(UnitTestCase): |
1218 | - """Test glob matching where the glob includes []s and [!]s""" |
1219 | + u"""Test glob matching where the glob includes []s and [!]s""" |
1220 | |
1221 | def test_square_bracket_options(self): |
1222 | - """Test file including options in []s""" |
1223 | + u"""Test file including options in []s""" |
1224 | self.assertEqual(inc_sel_file(u"/test/f[o,s,p]lder/foo.txt", |
1225 | u"/test/folder/foo.txt"), 1) |
1226 | self.assertEqual(inc_sel_file(u"/test/f[i,s,p]lder/foo.txt", |
1227 | @@ -254,14 +254,14 @@ |
1228 | u"/test/folder/foo.txt"), 1) |
1229 | |
1230 | def test_square_bracket_options_unicode(self): |
1231 | - """Test file including options in []s""" |
1232 | + u"""Test file including options in []s""" |
1233 | self.assertEqual(inc_sel_file(u"прыклад/пр[и,j,l]мер/例/Παράδειγμα/उदाहरण.txt", |
1234 | u"прыклад/пример/例/Παράδειγμα/उदाहरण.txt"), 1) |
1235 | self.assertEqual(inc_sel_file(u"прыклад/п[a,b,c]имер/例/Παράδειγμα/उदाहरण.txt", |
1236 | u"прыклад/пример/例/Παράδειγμα/उदाहरण.txt"), None) |
1237 | |
1238 | def test_not_square_bracket_options(self): |
1239 | - """Test file including options in [!]s""" |
1240 | + u"""Test file including options in [!]s""" |
1241 | self.assertEqual(inc_sel_file(u"/test/f[!o,s,p]lder/foo.txt", |
1242 | u"/test/folder/foo.txt"), None) |
1243 | self.assertEqual(inc_sel_file(u"/test/f[!i,s,p]lder/foo.txt", |
1244 | @@ -270,7 +270,7 @@ |
1245 | u"/test/folder/foo.txt"), None) |
1246 | |
1247 | def test_square_bracket_range(self): |
1248 | - """Test file including range in []s""" |
1249 | + u"""Test file including range in []s""" |
1250 | self.assertEqual(inc_sel_file(u"/test/folder[1-5]/foo.txt", |
1251 | u"/test/folder4/foo.txt"), 1) |
1252 | self.assertEqual(inc_sel_file(u"/test/folder[5-9]/foo.txt", |
1253 | @@ -279,7 +279,7 @@ |
1254 | u"/test/folder6/foo.txt"), None) |
1255 | |
1256 | def test_square_bracket_not_range(self): |
1257 | - """Test file including range in [!]s""" |
1258 | + u"""Test file including range in [!]s""" |
1259 | self.assertEqual(inc_sel_file(u"/test/folder[!1-5]/foo.txt", |
1260 | u"/test/folder4/foo.txt"), None) |
1261 | self.assertEqual(inc_sel_file(u"/test/folder[!5-9]/foo.txt", |
1262 | |
1263 | === modified file 'testing/unit/test_selection.py' |
1264 | --- testing/unit/test_selection.py 2017-07-15 20:31:11 +0000 |
1265 | +++ testing/unit/test_selection.py 2018-07-19 21:12:04 +0000 |
1266 | @@ -33,7 +33,7 @@ |
1267 | |
1268 | |
1269 | class MatchingTest(UnitTestCase): |
1270 | - """Test matching of file names against various selection functions""" |
1271 | + u"""Test matching of file names against various selection functions""" |
1272 | def setUp(self): |
1273 | super(MatchingTest, self).setUp() |
1274 | self.unpack_testfiles() |
1275 | @@ -44,7 +44,7 @@ |
1276 | return self.root.new_index(tuple(path.split(u"/"))) |
1277 | |
1278 | def testRegexp(self): |
1279 | - """Test regular expression selection func""" |
1280 | + u"""Test regular expression selection func""" |
1281 | sf1 = self.Select.regexp_get_sf(u".*\.py", 1) |
1282 | assert sf1(self.makeext(u"1.py")) == 1 |
1283 | assert sf1(self.makeext(u"usr/foo.py")) == 1 |
1284 | @@ -56,7 +56,7 @@ |
1285 | assert sf2(Path(u"foo")) is None |
1286 | |
1287 | def test_tuple_include(self): |
1288 | - """Test include selection function made from a regular filename""" |
1289 | + u"""Test include selection function made from a regular filename""" |
1290 | self.assertRaises(FilePrefixError, self.Select.glob_get_normal_sf, |
1291 | u"foo", 1) |
1292 | |
1293 | @@ -76,7 +76,7 @@ |
1294 | self.assertEqual(sf2(self.makeext(u"usr/local/bingzip")), None) |
1295 | |
1296 | def test_tuple_exclude(self): |
1297 | - """Test exclude selection function made from a regular filename""" |
1298 | + u"""Test exclude selection function made from a regular filename""" |
1299 | self.assertRaises(FilePrefixError, self.Select.glob_get_normal_sf, |
1300 | u"foo", 0) |
1301 | |
1302 | @@ -93,7 +93,7 @@ |
1303 | assert sf2(self.makeext(u"usr/local/bingzip")) is None |
1304 | |
1305 | def test_glob_star_include(self): |
1306 | - """Test a few globbing patterns, including **""" |
1307 | + u"""Test a few globbing patterns, including **""" |
1308 | sf1 = self.Select.glob_get_sf(u"**", 1) |
1309 | assert sf1(self.makeext(u"foo")) == 1 |
1310 | assert sf1(self.makeext(u"")) == 1 |
1311 | @@ -105,7 +105,7 @@ |
1312 | assert sf2(self.makeext(u"what/ever.py/foo")) == 1 |
1313 | |
1314 | def test_glob_star_exclude(self): |
1315 | - """Test a few glob excludes, including **""" |
1316 | + u"""Test a few glob excludes, including **""" |
1317 | sf1 = self.Select.glob_get_sf(u"**", 0) |
1318 | assert sf1(self.makeext(u"/usr/local/bin")) == 0 |
1319 | |
1320 | @@ -116,16 +116,16 @@ |
1321 | assert sf2(self.makeext(u"what/ever.py/foo")) == 0 |
1322 | |
1323 | def test_simple_glob_double_asterisk(self): |
1324 | - """test_simple_glob_double_asterisk - primarily to check that the defaults used by the error tests work""" |
1325 | + u"""test_simple_glob_double_asterisk - primarily to check that the defaults used by the error tests work""" |
1326 | assert self.Select.glob_get_normal_sf(u"**", 1) |
1327 | |
1328 | def test_glob_sf_exception(self): |
1329 | - """test_glob_sf_exception - see if globbing errors returned""" |
1330 | + u"""test_glob_sf_exception - see if globbing errors returned""" |
1331 | self.assertRaises(GlobbingError, self.Select.glob_get_normal_sf, |
1332 | u"testfiles/select/hello//there", 1) |
1333 | |
1334 | def test_file_prefix_sf_exception(self): |
1335 | - """test_file_prefix_sf_exception - see if FilePrefix error is returned""" |
1336 | + u"""test_file_prefix_sf_exception - see if FilePrefix error is returned""" |
1337 | # These should raise a FilePrefixError because the root directory for the selection is "testfiles/select" |
1338 | self.assertRaises(FilePrefixError, |
1339 | self.Select.glob_get_sf, u"testfiles/whatever", 1) |
1340 | @@ -133,7 +133,7 @@ |
1341 | self.Select.glob_get_sf, u"testfiles/?hello", 0) |
1342 | |
1343 | def test_scan(self): |
1344 | - """Tests what is returned for selection tests regarding directory scanning""" |
1345 | + u"""Tests what is returned for selection tests regarding directory scanning""" |
1346 | select = Select(Path(u"/")) |
1347 | |
1348 | assert select.glob_get_sf(u"**.py", 1)(Path(u"/")) == 2 |
1349 | @@ -146,7 +146,7 @@ |
1350 | assert select.glob_get_normal_sf(u"/testfiles/select/test.py", 0)(Path(u"/testfiles/select")) is None |
1351 | |
1352 | def test_ignore_case(self): |
1353 | - """test_ignore_case - try a few expressions with ignorecase:""" |
1354 | + u"""test_ignore_case - try a few expressions with ignorecase:""" |
1355 | |
1356 | sf = self.Select.glob_get_sf(u"ignorecase:testfiles/SeLect/foo/bar", 1) |
1357 | assert sf(self.makeext(u"FOO/BAR")) == 1 |
1358 | @@ -155,7 +155,7 @@ |
1359 | self.assertRaises(FilePrefixError, self.Select.glob_get_sf, u"ignorecase:tesfiles/sect/foo/bar", 1) |
1360 | |
1361 | def test_root(self): |
1362 | - """test_root - / may be a counterexample to several of these..""" |
1363 | + u"""test_root - / may be a counterexample to several of these..""" |
1364 | root = Path(u"/") |
1365 | select = Select(root) |
1366 | |
1367 | @@ -173,7 +173,7 @@ |
1368 | assert select.glob_get_sf(u"/foo/*", 0)(root) is None |
1369 | |
1370 | def test_other_filesystems(self): |
1371 | - """Test to see if --exclude-other-filesystems works correctly""" |
1372 | + u"""Test to see if --exclude-other-filesystems works correctly""" |
1373 | root = Path(u"/") |
1374 | select = Select(root) |
1375 | sf = select.other_filesystems_get_sf(0) |
1376 | @@ -199,7 +199,7 @@ |
1377 | |
1378 | |
1379 | class ParseArgsTest(UnitTestCase): |
1380 | - """Test argument parsing""" |
1381 | + u"""Test argument parsing""" |
1382 | def setUp(self): |
1383 | super(ParseArgsTest, self).setUp() |
1384 | self.unpack_testfiles() |
1385 | @@ -217,12 +217,12 @@ |
1386 | (u"3", u"3sub3", u"3sub3sub3")] |
1387 | |
1388 | def uc_index_from_path(self, path): |
1389 | - """Takes a path type and returns path.index, with each element converted into unicode""" |
1390 | - uindex = tuple([element.decode(sys.getfilesystemencoding(), "strict") for element in path.index]) |
1391 | + u"""Takes a path type and returns path.index, with each element converted into unicode""" |
1392 | + uindex = tuple([element.decode(sys.getfilesystemencoding(), u"strict") for element in path.index]) |
1393 | return uindex |
1394 | |
1395 | def ParseTest(self, tuplelist, indicies, filelists=[]): |
1396 | - """No error if running select on tuple goes over indicies""" |
1397 | + u"""No error if running select on tuple goes over indicies""" |
1398 | if not self.root: |
1399 | self.root = Path(u"testfiles/select") |
1400 | self.Select = Select(self.root) |
1401 | @@ -236,7 +236,7 @@ |
1402 | self.assertEqual(indicies, results_as_list) |
1403 | |
1404 | def remake_filelists(self, filelist): |
1405 | - """Turn strings in filelist into fileobjs""" |
1406 | + u"""Turn strings in filelist into fileobjs""" |
1407 | new_filelists = [] |
1408 | for f in filelist: |
1409 | if isinstance(f, unicode): |
1410 | @@ -246,14 +246,14 @@ |
1411 | return new_filelists |
1412 | |
1413 | def test_parse(self): |
1414 | - """Test just one include, all exclude""" |
1415 | + u"""Test just one include, all exclude""" |
1416 | self.ParseTest([(u"--include", u"testfiles/select/1/1"), |
1417 | (u"--exclude", u"**")], |
1418 | [(), (u"1",), (u"1", u"1"), (u"1", u"1", u"1"), |
1419 | (u"1", u"1", u"2"), (u"1", u"1", u"3")]) |
1420 | |
1421 | def test_parse2(self): |
1422 | - """Test three level include/exclude""" |
1423 | + u"""Test three level include/exclude""" |
1424 | self.ParseTest([(u"--exclude", u"testfiles/select/1/1/1"), |
1425 | (u"--include", u"testfiles/select/1/1"), |
1426 | (u"--exclude", u"testfiles/select/1"), |
1427 | @@ -262,7 +262,7 @@ |
1428 | (u"1", u"1", u"3")]) |
1429 | |
1430 | def test_filelist(self): |
1431 | - """Filelist glob test similar to above testParse2""" |
1432 | + u"""Filelist glob test similar to above testParse2""" |
1433 | self.ParseTest([(u"--include-filelist", u"file")], |
1434 | [(), (u"1",), (u"1", u"1"), (u"1", u"1", u"2"), |
1435 | (u"1", u"1", u"3")], |
1436 | @@ -272,7 +272,7 @@ |
1437 | u"- **"]) |
1438 | |
1439 | def test_include_filelist_1_trailing_whitespace(self): |
1440 | - """Filelist glob test similar to globbing filelist, but with 1 trailing whitespace on include""" |
1441 | + u"""Filelist glob test similar to globbing filelist, but with 1 trailing whitespace on include""" |
1442 | self.ParseTest([(u"--include-filelist", u"file")], |
1443 | [(), (u"1",), (u"1", u"1"), (u"1", u"1", u"2"), |
1444 | (u"1", u"1", u"3")], |
1445 | @@ -282,7 +282,7 @@ |
1446 | u"- **"]) |
1447 | |
1448 | def test_include_filelist_2_trailing_whitespaces(self): |
1449 | - """Filelist glob test similar to globbing filelist, but with 2 trailing whitespaces on include""" |
1450 | + u"""Filelist glob test similar to globbing filelist, but with 2 trailing whitespaces on include""" |
1451 | self.ParseTest([(u"--include-filelist", u"file")], |
1452 | [(), (u"1",), (u"1", u"1"), (u"1", u"1", u"2"), |
1453 | (u"1", u"1", u"3")], |
1454 | @@ -292,7 +292,7 @@ |
1455 | u"- **"]) |
1456 | |
1457 | def test_include_filelist_1_leading_whitespace(self): |
1458 | - """Filelist glob test similar to globbing filelist, but with 1 leading whitespace on include""" |
1459 | + u"""Filelist glob test similar to globbing filelist, but with 1 leading whitespace on include""" |
1460 | self.ParseTest([(u"--include-filelist", u"file")], |
1461 | [(), (u"1",), (u"1", u"1"), (u"1", u"1", u"2"), |
1462 | (u"1", u"1", u"3")], |
1463 | @@ -302,7 +302,7 @@ |
1464 | u"- **"]) |
1465 | |
1466 | def test_include_filelist_2_leading_whitespaces(self): |
1467 | - """Filelist glob test similar to globbing filelist, but with 2 leading whitespaces on include""" |
1468 | + u"""Filelist glob test similar to globbing filelist, but with 2 leading whitespaces on include""" |
1469 | self.ParseTest([(u"--include-filelist", u"file")], |
1470 | [(), (u"1",), (u"1", u"1"), (u"1", u"1", u"2"), |
1471 | (u"1", u"1", u"3")], |
1472 | @@ -312,7 +312,7 @@ |
1473 | u"- **"]) |
1474 | |
1475 | def test_include_filelist_1_trailing_whitespace_exclude(self): |
1476 | - """Filelist glob test similar to globbing filelist, but with 1 trailing whitespace on exclude""" |
1477 | + u"""Filelist glob test similar to globbing filelist, but with 1 trailing whitespace on exclude""" |
1478 | self.ParseTest([(u"--include-filelist", u"file")], |
1479 | [(), (u"1",), (u"1", u"1"), (u"1", u"1", u"2"), |
1480 | (u"1", u"1", u"3")], |
1481 | @@ -322,7 +322,7 @@ |
1482 | u"- **"]) |
1483 | |
1484 | def test_include_filelist_2_trailing_whitespace_exclude(self): |
1485 | - """Filelist glob test similar to globbing filelist, but with 2 trailing whitespaces on exclude""" |
1486 | + u"""Filelist glob test similar to globbing filelist, but with 2 trailing whitespaces on exclude""" |
1487 | self.ParseTest([(u"--include-filelist", u"file")], |
1488 | [(), (u"1",), (u"1", u"1"), (u"1", u"1", u"2"), |
1489 | (u"1", u"1", u"3")], |
1490 | @@ -332,7 +332,7 @@ |
1491 | u"- **"]) |
1492 | |
1493 | def test_include_filelist_1_leading_whitespace_exclude(self): |
1494 | - """Filelist glob test similar to globbing filelist, but with 1 leading whitespace on exclude""" |
1495 | + u"""Filelist glob test similar to globbing filelist, but with 1 leading whitespace on exclude""" |
1496 | self.ParseTest([(u"--include-filelist", u"file")], |
1497 | [(), (u"1",), (u"1", u"1"), (u"1", u"1", u"2"), |
1498 | (u"1", u"1", u"3")], |
1499 | @@ -342,7 +342,7 @@ |
1500 | u"- **"]) |
1501 | |
1502 | def test_include_filelist_2_leading_whitespaces_exclude(self): |
1503 | - """Filelist glob test similar to globbing filelist, but with 2 leading whitespaces on exclude""" |
1504 | + u"""Filelist glob test similar to globbing filelist, but with 2 leading whitespaces on exclude""" |
1505 | self.ParseTest([(u"--include-filelist", u"file")], |
1506 | [(), (u"1",), (u"1", u"1"), (u"1", u"1", u"2"), |
1507 | (u"1", u"1", u"3")], |
1508 | @@ -352,7 +352,7 @@ |
1509 | u"- **"]) |
1510 | |
1511 | def test_include_filelist_check_excluded_folder_included_for_contents(self): |
1512 | - """Filelist glob test to check excluded folder is included if contents are""" |
1513 | + u"""Filelist glob test to check excluded folder is included if contents are""" |
1514 | self.ParseTest([(u"--include-filelist", u"file")], |
1515 | [(), (u"1",), (u"1", u"1"), (u"1", u"1", u"1"), (u"1", u"1", u"2"), |
1516 | (u"1", u"1", u"3"), (u"1", u"2"), (u"1", u"2", u"1"), (u"1", u"3"), (u"1", u"3", u"1"), |
1517 | @@ -363,7 +363,7 @@ |
1518 | u"- **"]) |
1519 | |
1520 | def test_include_filelist_with_unnecessary_quotes(self): |
1521 | - """Filelist glob test similar to globbing filelist, but with quotes around one of the paths.""" |
1522 | + u"""Filelist glob test similar to globbing filelist, but with quotes around one of the paths.""" |
1523 | self.ParseTest([(u"--include-filelist", u"file")], |
1524 | [(), (u"1",), (u"1", u"1"), (u"1", u"1", u"2"), |
1525 | (u"1", u"1", u"3")], |
1526 | @@ -373,7 +373,7 @@ |
1527 | u"- **"]) |
1528 | |
1529 | def test_include_filelist_with_unnecessary_double_quotes(self): |
1530 | - """Filelist glob test similar to globbing filelist, but with double quotes around one of the paths.""" |
1531 | + u"""Filelist glob test similar to globbing filelist, but with double quotes around one of the paths.""" |
1532 | self.ParseTest([(u"--include-filelist", u"file")], |
1533 | [(), (u"1",), (u"1", u"1"), (u"1", u"1", u"2"), |
1534 | (u"1", u"1", u"3")], |
1535 | @@ -383,7 +383,7 @@ |
1536 | u"- **"]) |
1537 | |
1538 | def test_include_filelist_with_full_line_comment(self): |
1539 | - """Filelist glob test similar to globbing filelist, but with a full-line comment.""" |
1540 | + u"""Filelist glob test similar to globbing filelist, but with a full-line comment.""" |
1541 | self.ParseTest([(u"--include-filelist", u"file")], |
1542 | [(), (u"1",), (u"1", u"1"), (u"1", u"1", u"2"), |
1543 | (u"1", u"1", u"3")], |
1544 | @@ -394,7 +394,7 @@ |
1545 | u"- **"]) |
1546 | |
1547 | def test_include_filelist_with_blank_line(self): |
1548 | - """Filelist glob test similar to globbing filelist, but with a blank line.""" |
1549 | + u"""Filelist glob test similar to globbing filelist, but with a blank line.""" |
1550 | self.ParseTest([(u"--include-filelist", u"file")], |
1551 | [(), (u"1",), (u"1", u"1"), (u"1", u"1", u"2"), |
1552 | (u"1", u"1", u"3")], |
1553 | @@ -405,7 +405,7 @@ |
1554 | u"- **"]) |
1555 | |
1556 | def test_include_filelist_with_blank_line_and_whitespace(self): |
1557 | - """Filelist glob test similar to globbing filelist, but with a blank line and whitespace.""" |
1558 | + u"""Filelist glob test similar to globbing filelist, but with a blank line and whitespace.""" |
1559 | self.ParseTest([(u"--include-filelist", u"file")], |
1560 | [(), (u"1",), (u"1", u"1"), (u"1", u"1", u"2"), |
1561 | (u"1", u"1", u"3")], |
1562 | @@ -416,7 +416,7 @@ |
1563 | u"- **"]) |
1564 | |
1565 | def test_include_filelist_asterisk(self): |
1566 | - """Filelist glob test with * instead of 'testfiles'""" |
1567 | + u"""Filelist glob test with * instead of 'testfiles'""" |
1568 | # Thank you to Elifarley Cruz for this test case |
1569 | # (https://bugs.launchpad.net/duplicity/+bug/884371). |
1570 | self.ParseTest([(u"--include-filelist", u"file")], |
1571 | @@ -426,7 +426,7 @@ |
1572 | u"- **"]) |
1573 | |
1574 | def test_include_filelist_asterisk_2(self): |
1575 | - """Identical to test_filelist, but with the exclude "select" replaced with '*'""" |
1576 | + u"""Identical to test_filelist, but with the exclude "select" replaced with '*'""" |
1577 | self.ParseTest([(u"--include-filelist", u"file")], |
1578 | [(), (u"1",), (u"1", u"1"), (u"1", u"1", u"2"), |
1579 | (u"1", u"1", u"3")], |
1580 | @@ -436,7 +436,7 @@ |
1581 | u"- **"]) |
1582 | |
1583 | def test_include_filelist_asterisk_3(self): |
1584 | - """Identical to test_filelist, but with the auto-include "select" replaced with '*'""" |
1585 | + u"""Identical to test_filelist, but with the auto-include "select" replaced with '*'""" |
1586 | # Regression test for Bug #884371 (https://bugs.launchpad.net/duplicity/+bug/884371) |
1587 | self.ParseTest([(u"--include-filelist", u"file")], |
1588 | [(), (u"1",), (u"1", u"1"), (u"1", u"1", u"2"), |
1589 | @@ -447,7 +447,7 @@ |
1590 | u"- **"]) |
1591 | |
1592 | def test_include_filelist_asterisk_4(self): |
1593 | - """Identical to test_filelist, but with a specific include "select" replaced with '*'""" |
1594 | + u"""Identical to test_filelist, but with a specific include "select" replaced with '*'""" |
1595 | # Regression test for Bug #884371 (https://bugs.launchpad.net/duplicity/+bug/884371) |
1596 | self.ParseTest([(u"--include-filelist", u"file")], |
1597 | [(), (u"1",), (u"1", u"1"), (u"1", u"1", u"2"), |
1598 | @@ -458,7 +458,7 @@ |
1599 | u"- **"]) |
1600 | |
1601 | def test_include_filelist_asterisk_5(self): |
1602 | - """Identical to test_filelist, but with all 'select's replaced with '*'""" |
1603 | + u"""Identical to test_filelist, but with all 'select's replaced with '*'""" |
1604 | # Regression test for Bug #884371 (https://bugs.launchpad.net/duplicity/+bug/884371) |
1605 | self.ParseTest([(u"--include-filelist", u"file")], |
1606 | [(), (u"1",), (u"1", u"1"), (u"1", u"1", u"2"), |
1607 | @@ -469,7 +469,7 @@ |
1608 | u"- **"]) |
1609 | |
1610 | def test_include_filelist_asterisk_6(self): |
1611 | - """Identical to test_filelist, but with numerous excluded folders replaced with '*'""" |
1612 | + u"""Identical to test_filelist, but with numerous excluded folders replaced with '*'""" |
1613 | self.ParseTest([(u"--include-filelist", u"file")], |
1614 | [(), (u"1",), (u"1", u"1"), (u"1", u"1", u"2"), |
1615 | (u"1", u"1", u"3")], |
1616 | @@ -479,7 +479,7 @@ |
1617 | u"- **"]) |
1618 | |
1619 | def test_include_filelist_asterisk_7(self): |
1620 | - """Identical to test_filelist, but with numerous included/excluded folders replaced with '*'""" |
1621 | + u"""Identical to test_filelist, but with numerous included/excluded folders replaced with '*'""" |
1622 | # Regression test for Bug #884371 (https://bugs.launchpad.net/duplicity/+bug/884371) |
1623 | self.ParseTest([(u"--include-filelist", u"file")], |
1624 | [(), (u"1",), (u"1", u"1"), (u"1", u"1", u"2"), |
1625 | @@ -490,7 +490,7 @@ |
1626 | u"- **"]) |
1627 | |
1628 | def test_include_filelist_double_asterisk_1(self): |
1629 | - """Identical to test_filelist, but with the exclude "select' replaced with '**'""" |
1630 | + u"""Identical to test_filelist, but with the exclude "select' replaced with '**'""" |
1631 | self.ParseTest([(u"--include-filelist", u"file")], |
1632 | [(), (u"1",), (u"1", u"1"), (u"1", u"1", u"2"), |
1633 | (u"1", u"1", u"3")], |
1634 | @@ -500,7 +500,7 @@ |
1635 | u"- **"]) |
1636 | |
1637 | def test_include_filelist_double_asterisk_2(self): |
1638 | - """Identical to test_filelist, but with the include 'select' replaced with '**'""" |
1639 | + u"""Identical to test_filelist, but with the include 'select' replaced with '**'""" |
1640 | # Regression test for Bug #884371 (https://bugs.launchpad.net/duplicity/+bug/884371) |
1641 | self.ParseTest([(u"--include-filelist", u"file")], |
1642 | [(), (u"1",), (u"1", u"1"), (u"1", u"1", u"2"), |
1643 | @@ -511,7 +511,7 @@ |
1644 | u"- **"]) |
1645 | |
1646 | def test_include_filelist_double_asterisk_3(self): |
1647 | - """Identical to test_filelist, but with the exclude 'testfiles/select' replaced with '**'""" |
1648 | + u"""Identical to test_filelist, but with the exclude 'testfiles/select' replaced with '**'""" |
1649 | self.ParseTest([(u"--include-filelist", u"file")], |
1650 | [(), (u"1",), (u"1", u"1"), (u"1", u"1", u"2"), |
1651 | (u"1", u"1", u"3")], |
1652 | @@ -521,7 +521,7 @@ |
1653 | u"- **"]) |
1654 | |
1655 | def test_include_filelist_double_asterisk_4(self): |
1656 | - """Identical to test_filelist, but with the include 'testfiles/select' replaced with '**'""" |
1657 | + u"""Identical to test_filelist, but with the include 'testfiles/select' replaced with '**'""" |
1658 | # Regression test for Bug #884371 (https://bugs.launchpad.net/duplicity/+bug/884371) |
1659 | self.ParseTest([(u"--include-filelist", u"file")], |
1660 | [(), (u"1",), (u"1", u"1"), (u"1", u"1", u"2"), |
1661 | @@ -532,7 +532,7 @@ |
1662 | u"- **"]) |
1663 | |
1664 | def test_include_filelist_double_asterisk_5(self): |
1665 | - """Identical to test_filelist, but with all 'testfiles/select's replaced with '**'""" |
1666 | + u"""Identical to test_filelist, but with all 'testfiles/select's replaced with '**'""" |
1667 | # Regression test for Bug #884371 (https://bugs.launchpad.net/duplicity/+bug/884371) |
1668 | self.ParseTest([(u"--include-filelist", u"file")], |
1669 | [(), (u"1",), (u"1", u"1"), (u"1", u"1", u"2"), |
1670 | @@ -543,7 +543,7 @@ |
1671 | u"- **"]) |
1672 | |
1673 | def test_include_filelist_trailing_slashes(self): |
1674 | - """Filelist glob test similar to globbing filelist, but with trailing slashes""" |
1675 | + u"""Filelist glob test similar to globbing filelist, but with trailing slashes""" |
1676 | self.ParseTest([(u"--include-filelist", u"file")], |
1677 | [(), (u"1",), (u"1", u"1"), (u"1", u"1", u"2"), |
1678 | (u"1", u"1", u"3")], |
1679 | @@ -553,7 +553,7 @@ |
1680 | u"- **"]) |
1681 | |
1682 | def test_include_filelist_trailing_slashes_and_single_asterisks(self): |
1683 | - """Filelist glob test similar to globbing filelist, but with trailing slashes and single asterisks""" |
1684 | + u"""Filelist glob test similar to globbing filelist, but with trailing slashes and single asterisks""" |
1685 | # Regression test for Bug #932482 (https://bugs.launchpad.net/duplicity/+bug/932482) |
1686 | self.ParseTest([(u"--include-filelist", u"file")], |
1687 | [(), (u"1",), (u"1", u"1"), (u"1", u"1", u"2"), |
1688 | @@ -564,7 +564,7 @@ |
1689 | u"- **"]) |
1690 | |
1691 | def test_include_filelist_trailing_slashes_and_double_asterisks(self): |
1692 | - """Filelist glob test similar to globbing filelist, but with trailing slashes and double asterisks""" |
1693 | + u"""Filelist glob test similar to globbing filelist, but with trailing slashes and double asterisks""" |
1694 | # Regression test for Bug #932482 (https://bugs.launchpad.net/duplicity/+bug/932482) |
1695 | self.ParseTest([(u"--include-filelist", u"file")], |
1696 | [(), (u"1",), (u"1", u"1"), (u"1", u"1", u"2"), |
1697 | @@ -575,7 +575,7 @@ |
1698 | u"- **"]) |
1699 | |
1700 | def test_filelist_null_separator(self): |
1701 | - """test_filelist, but with null_separator set""" |
1702 | + u"""test_filelist, but with null_separator set""" |
1703 | self.set_global(u"null_separator", 1) |
1704 | self.ParseTest([(u"--include-filelist", u"file")], |
1705 | [(), (u"1",), (u"1", u"1"), (u"1", u"1", u"2"), |
1706 | @@ -583,7 +583,7 @@ |
1707 | [u"\0- testfiles/select/1/1/1\0testfiles/select/1/1\0- testfiles/select/1\0- **\0"]) |
1708 | |
1709 | def test_exclude_filelist(self): |
1710 | - """Exclude version of test_filelist""" |
1711 | + u"""Exclude version of test_filelist""" |
1712 | self.ParseTest([(u"--exclude-filelist", u"file")], |
1713 | [(), (u"1",), (u"1", u"1"), (u"1", u"1", u"2"), |
1714 | (u"1", u"1", u"3")], |
1715 | @@ -593,7 +593,7 @@ |
1716 | u"- **"]) |
1717 | |
1718 | def test_exclude_filelist_asterisk_1(self): |
1719 | - """Exclude version of test_include_filelist_asterisk""" |
1720 | + u"""Exclude version of test_include_filelist_asterisk""" |
1721 | self.ParseTest([(u"--exclude-filelist", u"file")], |
1722 | [(), (u"1",), (u"1", u"1"), (u"1", u"1", u"1"), |
1723 | (u"1", u"1", u"2"), (u"1", u"1", u"3")], |
1724 | @@ -601,9 +601,9 @@ |
1725 | u"- **"]) |
1726 | |
1727 | def test_exclude_filelist_asterisk_2(self): |
1728 | - """Identical to test_exclude_filelist, but with the exclude "select" replaced with '*'""" |
1729 | + u"""Identical to test_exclude_filelist, but with the exclude "select" replaced with '*'""" |
1730 | self.ParseTest([(u"--exclude-filelist", u"file")], |
1731 | - [(), (u"1",), (u"1", "1"), (u"1", u"1", u"2"), |
1732 | + [(), (u"1",), (u"1", u"1"), (u"1", u"1", u"2"), |
1733 | (u"1", u"1", u"3")], |
1734 | [u"testfiles/*/1/1/1\n" |
1735 | u"+ testfiles/select/1/1\n" |
1736 | @@ -611,7 +611,7 @@ |
1737 | u"- **"]) |
1738 | |
1739 | def test_exclude_filelist_asterisk_3(self): |
1740 | - """Identical to test_exclude_filelist, but with the include "select" replaced with '*'""" |
1741 | + u"""Identical to test_exclude_filelist, but with the include "select" replaced with '*'""" |
1742 | # Regression test for Bug #884371 (https://bugs.launchpad.net/duplicity/+bug/884371) |
1743 | self.ParseTest([(u"--exclude-filelist", u"file")], |
1744 | [(), (u"1",), (u"1", u"1"), (u"1", u"1", u"2"), |
1745 | @@ -622,7 +622,7 @@ |
1746 | u"- **"]) |
1747 | |
1748 | def test_exclude_filelist_asterisk_4(self): |
1749 | - """Identical to test_exclude_filelist, but with numerous excluded folders replaced with '*'""" |
1750 | + u"""Identical to test_exclude_filelist, but with numerous excluded folders replaced with '*'""" |
1751 | self.ParseTest([(u"--exclude-filelist", u"file")], |
1752 | [(), (u"1",), (u"1", u"1"), (u"1", u"1", u"2"), |
1753 | (u"1", u"1", u"3")], |
1754 | @@ -632,7 +632,7 @@ |
1755 | u"- **"]) |
1756 | |
1757 | def test_exclude_filelist_asterisk_5(self): |
1758 | - """Identical to test_exclude_filelist, but with numerous included/excluded folders replaced with '*'""" |
1759 | + u"""Identical to test_exclude_filelist, but with numerous included/excluded folders replaced with '*'""" |
1760 | # Regression test for Bug #884371 (https://bugs.launchpad.net/duplicity/+bug/884371) |
1761 | self.ParseTest([(u"--exclude-filelist", u"file")], |
1762 | [(), (u"1",), (u"1", u"1"), (u"1", u"1", u"2"), |
1763 | @@ -643,7 +643,7 @@ |
1764 | u"- **"]) |
1765 | |
1766 | def test_exclude_filelist_double_asterisk(self): |
1767 | - """Identical to test_exclude_filelist, but with all included/excluded folders replaced with '**'""" |
1768 | + u"""Identical to test_exclude_filelist, but with all included/excluded folders replaced with '**'""" |
1769 | # Regression test for Bug #884371 (https://bugs.launchpad.net/duplicity/+bug/884371) |
1770 | self.ParseTest([(u"--exclude-filelist", u"file")], |
1771 | [(), (u"1",), (u"1", u"1"), (u"1", u"1", u"2"), |
1772 | @@ -654,7 +654,7 @@ |
1773 | u"- **"]) |
1774 | |
1775 | def test_exclude_filelist_single_asterisk_at_beginning(self): |
1776 | - """Exclude filelist testing limited functionality of functional test""" |
1777 | + u"""Exclude filelist testing limited functionality of functional test""" |
1778 | # Regression test for Bug #884371 (https://bugs.launchpad.net/duplicity/+bug/884371) |
1779 | self.root = Path(u"testfiles/select/1") |
1780 | self.ParseTest([(u"--exclude-filelist", u"file")], |
1781 | @@ -665,7 +665,7 @@ |
1782 | u"- testfiles/select/1/3"]) |
1783 | |
1784 | def test_commandline_asterisks_double_both(self): |
1785 | - """Unit test the functional test TestAsterisks.test_commandline_asterisks_double_both""" |
1786 | + u"""Unit test the functional test TestAsterisks.test_commandline_asterisks_double_both""" |
1787 | self.root = Path(u"testfiles/select/1") |
1788 | self.ParseTest([(u"--include", u"**/1/2/1"), |
1789 | (u"--exclude", u"**t/1/2"), |
1790 | @@ -674,7 +674,7 @@ |
1791 | [(), (u"2",), (u"2", u"1")]) |
1792 | |
1793 | def test_includes_files(self): |
1794 | - """Unit test the functional test test_includes_files""" |
1795 | + u"""Unit test the functional test test_includes_files""" |
1796 | # Test for Bug 1624725 |
1797 | # https://bugs.launchpad.net/duplicity/+bug/1624725 |
1798 | self.root = Path(u"testfiles/select2/1/1sub1") |
1799 | @@ -684,7 +684,7 @@ |
1800 | u"1sub1sub1_file.txt")]) |
1801 | |
1802 | def test_includes_files_trailing_slash(self): |
1803 | - """Unit test the functional test test_includes_files_trailing_slash""" |
1804 | + u"""Unit test the functional test test_includes_files_trailing_slash""" |
1805 | # Test for Bug 1624725 |
1806 | # https://bugs.launchpad.net/duplicity/+bug/1624725 |
1807 | self.root = Path(u"testfiles/select2/1/1sub1") |
1808 | @@ -694,7 +694,7 @@ |
1809 | u"1sub1sub1_file.txt")]) |
1810 | |
1811 | def test_includes_files_trailing_slash_globbing_chars(self): |
1812 | - """Unit test functional test_includes_files_trailing_slash_globbing_chars""" |
1813 | + u"""Unit test functional test_includes_files_trailing_slash_globbing_chars""" |
1814 | # Test for Bug 1624725 |
1815 | # https://bugs.launchpad.net/duplicity/+bug/1624725 |
1816 | self.root = Path(u"testfiles/select2/1/1sub1") |
1817 | @@ -704,7 +704,7 @@ |
1818 | u"1sub1sub1_file.txt")]) |
1819 | |
1820 | def test_glob(self): |
1821 | - """Test globbing expression""" |
1822 | + u"""Test globbing expression""" |
1823 | self.ParseTest([(u"--exclude", u"**[3-5]"), |
1824 | (u"--include", u"testfiles/select/1"), |
1825 | (u"--exclude", u"**")], |
1826 | @@ -733,7 +733,7 @@ |
1827 | (u"3", u"3", u"2")]) |
1828 | |
1829 | def test_filelist2(self): |
1830 | - """Filelist glob test similar to above testGlob""" |
1831 | + u"""Filelist glob test similar to above testGlob""" |
1832 | self.ParseTest([(u"--exclude-filelist", u"asoeuth")], |
1833 | [(), (u"1",), (u"1", u"1"), |
1834 | (u"1", u"1", u"1"), (u"1", u"1", u"2"), |
1835 | @@ -768,7 +768,7 @@ |
1836 | """]) |
1837 | |
1838 | def test_glob2(self): |
1839 | - """Test more globbing functions""" |
1840 | + u"""Test more globbing functions""" |
1841 | self.ParseTest([(u"--include", u"testfiles/select/*foo*/p*"), |
1842 | (u"--exclude", u"**")], |
1843 | [(), (u"efools",), (u"efools", u"ping"), |
1844 | @@ -781,7 +781,7 @@ |
1845 | [(), (u"1",), (u"1", u"1"), (u"1", u"2")]) |
1846 | |
1847 | def test_glob3(self): |
1848 | - """ regression test for bug 25230 """ |
1849 | + u""" regression test for bug 25230 """ |
1850 | self.ParseTest([(u"--include", u"testfiles/select/**1"), |
1851 | (u"--include", u"testfiles/select/**2"), |
1852 | (u"--exclude", u"**")], |
1853 | @@ -805,7 +805,7 @@ |
1854 | (u"3", u"3", u"1"), (u"3", u"3", u"2")]) |
1855 | |
1856 | def test_alternate_root(self): |
1857 | - """Test select with different root""" |
1858 | + u"""Test select with different root""" |
1859 | self.root = Path(u"testfiles/select/1") |
1860 | self.ParseTest([(u"--exclude", u"testfiles/select/1/[23]")], |
1861 | [(), (u"1",), (u"1", u"1"), (u"1", u"2"), (u"1", u"3")]) |
1862 | @@ -817,7 +817,7 @@ |
1863 | [(), (u"tmp",)]) |
1864 | |
1865 | def test_exclude_after_scan(self): |
1866 | - """Test select with an exclude after a pattern that would return a scan for that file""" |
1867 | + u"""Test select with an exclude after a pattern that would return a scan for that file""" |
1868 | self.root = Path(u"testfiles/select2/3") |
1869 | self.ParseTest([(u"--include", u"testfiles/select2/3/**file.txt"), |
1870 | (u"--exclude", u"testfiles/select2/3/3sub2"), |
1871 | @@ -827,7 +827,7 @@ |
1872 | (u"3sub3",), (u"3sub3", u"3sub3sub2"), (u"3sub3", u"3sub3sub2", u"3sub3sub2_file.txt")]) |
1873 | |
1874 | def test_include_exclude_basic(self): |
1875 | - """Test functional test test_include_exclude_basic as a unittest""" |
1876 | + u"""Test functional test test_include_exclude_basic as a unittest""" |
1877 | self.root = Path(u"testfiles/select2") |
1878 | self.ParseTest([(u"--include", u"testfiles/select2/3/3sub3/3sub3sub2/3sub3sub2_file.txt"), |
1879 | (u"--exclude", u"testfiles/select2/3/3sub3/3sub3sub2"), |
1880 | @@ -851,7 +851,7 @@ |
1881 | self.expected_restored_tree) |
1882 | |
1883 | def test_globbing_replacement(self): |
1884 | - """Test functional test test_globbing_replacement as a unittest""" |
1885 | + u"""Test functional test test_globbing_replacement as a unittest""" |
1886 | self.root = Path(u"testfiles/select2") |
1887 | self.ParseTest([(u"--include", u"testfiles/select2/**/3sub3sub2/3sub3su?2_file.txt"), |
1888 | (u"--exclude", u"testfiles/select2/*/3s*1"), |
1889 | @@ -871,7 +871,7 @@ |
1890 | self.expected_restored_tree) |
1891 | |
1892 | def test_unicode_paths_non_globbing(self): |
1893 | - """Test functional test test_unicode_paths_non_globbing as a unittest""" |
1894 | + u"""Test functional test test_unicode_paths_non_globbing as a unittest""" |
1895 | self.root = Path(u"testfiles/select-unicode") |
1896 | self.ParseTest([(u"--exclude", u"testfiles/select-unicode/прыклад/пример/例/Παράδειγμα/उदाहरण.txt"), |
1897 | (u"--exclude", u"testfiles/select-unicode/прыклад/пример/例/Παράδειγμα/דוגמא.txt"), |
1898 | @@ -888,10 +888,10 @@ |
1899 | |
1900 | |
1901 | class TestGlobGetNormalSf(UnitTestCase): |
1902 | - """Test glob parsing of the test_glob_get_normal_sf function. Indirectly test behaviour of glob_to_re.""" |
1903 | + u"""Test glob parsing of the test_glob_get_normal_sf function. Indirectly test behaviour of glob_to_re.""" |
1904 | |
1905 | def glob_tester(self, path, glob_string, include_exclude, root_path): |
1906 | - """Takes a path, glob string and include_exclude value (1 = include, 0 = exclude) and returns the output |
1907 | + u"""Takes a path, glob string and include_exclude value (1 = include, 0 = exclude) and returns the output |
1908 | of the selection function. |
1909 | None - means the test has nothing to say about the related file |
1910 | 0 - the file is excluded by the test |
1911 | @@ -911,17 +911,17 @@ |
1912 | return self.glob_tester(path, glob_string, 0, root_path) |
1913 | |
1914 | def test_glob_get_normal_sf_exclude(self): |
1915 | - """Test simple exclude.""" |
1916 | + u"""Test simple exclude.""" |
1917 | self.assertEqual(self.exclude_glob_tester(u"/testfiles/select2/3", u"/testfiles/select2"), 0) |
1918 | self.assertEqual(self.exclude_glob_tester(u"/testfiles/.git", u"/testfiles"), 0) |
1919 | |
1920 | def test_glob_get_normal_sf_exclude_root(self): |
1921 | - """Test simple exclude with / as the glob.""" |
1922 | + u"""Test simple exclude with / as the glob.""" |
1923 | self.assertEqual(self.exclude_glob_tester(u"/.git", u"/"), 0) |
1924 | self.assertEqual(self.exclude_glob_tester(u"/testfile", u"/"), 0) |
1925 | |
1926 | def test_glob_get_normal_sf_2(self): |
1927 | - """Test same behaviour as the functional test test_globbing_replacement.""" |
1928 | + u"""Test same behaviour as the functional test test_globbing_replacement.""" |
1929 | self.assertEqual(self.include_glob_tester(u"/testfiles/select2/3/3sub3/3sub3sub2/3sub3sub2_file.txt", |
1930 | u"/testfiles/select2/**/3sub3sub2/3sub3su?2_file.txt"), 1) |
1931 | self.assertEqual(self.include_glob_tester(u"/testfiles/select2/3/3sub1", u"/testfiles/select2/*/3s*1"), 1) |
1932 | @@ -945,7 +945,7 @@ |
1933 | self.assertEqual(self.include_glob_tester(u"/testfiles/select2/1", u"**/select2/1"), 1) |
1934 | |
1935 | def test_glob_get_normal_sf_negative_square_brackets_specified(self): |
1936 | - """Test negative square bracket (specified) [!a,b,c] replacement in get_normal_sf.""" |
1937 | + u"""Test negative square bracket (specified) [!a,b,c] replacement in get_normal_sf.""" |
1938 | # As in a normal shell, [!...] expands to any single character but those specified |
1939 | self.assertEqual(self.include_glob_tester(u"/test/hello1.txt", u"/test/hello[!2,3,4].txt"), 1) |
1940 | self.assertEqual(self.include_glob_tester(u"/test/hello.txt", u"/t[!w,f,h]st/hello.txt"), 1) |
1941 | @@ -957,7 +957,7 @@ |
1942 | u"/lon[!w,e,g,f]/e[!p,x]ample/path/hello.txt"), None) |
1943 | |
1944 | def test_glob_get_normal_sf_negative_square_brackets_range(self): |
1945 | - """Test negative square bracket (range) [!a,b,c] replacement in get_normal_sf.""" |
1946 | + u"""Test negative square bracket (range) [!a,b,c] replacement in get_normal_sf.""" |
1947 | # As in a normal shell, [!1-5] or [!a-f] expands to any single character not in the range specified |
1948 | self.assertEqual(self.include_glob_tester(u"/test/hello1.txt", u"/test/hello[!2-4].txt"), 1) |
1949 | self.assertEqual(self.include_glob_tester(u"/test/hello.txt", u"/t[!f-h]st/hello.txt"), 1) |
1950 | @@ -969,7 +969,7 @@ |
1951 | u"/lon[!f-p]/e[!p]ample/path/hello.txt"), None) |
1952 | |
1953 | def test_glob_get_normal_sf_2_ignorecase(self): |
1954 | - """Test same behaviour as the functional test test_globbing_replacement, ignorecase tests.""" |
1955 | + u"""Test same behaviour as the functional test test_globbing_replacement, ignorecase tests.""" |
1956 | self.assertEqual(self.include_glob_tester(u"testfiles/select2/2/2sub1", |
1957 | u"ignorecase:testfiles/sel[w,u,e,q]ct2/2/2S?b1", |
1958 | u"testfiles/select2"), 1) |
1959 | @@ -978,12 +978,12 @@ |
1960 | u"testfiles/select2"), 1) |
1961 | |
1962 | def test_glob_get_normal_sf_3_double_asterisks_dirs_to_scan(self): |
1963 | - """Test double asterisk (**) replacement in glob_get_normal_sf with directories that should be scanned""" |
1964 | + u"""Test double asterisk (**) replacement in glob_get_normal_sf with directories that should be scanned""" |
1965 | # The new special pattern, **, expands to any string of characters whether or not it contains "/". |
1966 | self.assertEqual(self.include_glob_tester(u"/long/example/path", u"/**/hello.txt"), 2) |
1967 | |
1968 | def test_glob_get_normal_sf_3_ignorecase(self): |
1969 | - """Test ignorecase in glob_get_normal_sf""" |
1970 | + u"""Test ignorecase in glob_get_normal_sf""" |
1971 | # If the pattern starts with "ignorecase:" (case insensitive), then this prefix will be removed and any |
1972 | # character in the string can be replaced with an upper- or lowercase version of itself. |
1973 | self.assertEqual(self.include_glob_tester(u"testfiles/select2/2", u"ignorecase:testfiles/select2/2", |
1974 | @@ -1002,14 +1002,14 @@ |
1975 | u"testfiles/select2"), 0) |
1976 | |
1977 | def test_glob_dirs_to_scan(self): |
1978 | - """Test parent directories are marked as needing to be scanned""" |
1979 | + u"""Test parent directories are marked as needing to be scanned""" |
1980 | with patch(u"duplicity.path.Path.isdir") as mock_isdir: |
1981 | mock_isdir.return_value = True |
1982 | self.assertEqual( |
1983 | self.glob_tester(u"parent", u"parent/hello.txt", 1, u"parent"), 2) |
1984 | |
1985 | def test_glob_dirs_to_scan_glob(self): |
1986 | - """Test parent directories are marked as needing to be scanned - globs""" |
1987 | + u"""Test parent directories are marked as needing to be scanned - globs""" |
1988 | with patch(u"duplicity.path.Path.isdir") as mock_isdir: |
1989 | mock_isdir.return_value = True |
1990 | self.assertEqual( |
1991 | @@ -1051,5 +1051,5 @@ |
1992 | self.glob_tester(u"testfiles/select/1", |
1993 | u"*/select/1/1", 1, u"testfiles"), 2) |
1994 | |
1995 | -if __name__ == "__main__": |
1996 | +if __name__ == u"__main__": |
1997 | unittest.main() |
question. does it really make sense to adorn singular strings meant as a code comment only eg.
class GlobbingError( Exception) :
- """Something has gone wrong when parsing a glob string"""
+ u"""Something has gone wrong when parsing a glob string"""
pass
..ede