/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/tests/features.py

  • Committer: Breezy landing bot
  • Author(s): Jelmer Vernooij
  • Date: 2018-11-16 18:59:44 UTC
  • mfrom: (7143.15.15 more-cleanups)
  • Revision ID: breezy.the.bot@gmail.com-20181116185944-biefv1sub37qfybm
Sprinkle some PEP8iness.

Merged from https://code.launchpad.net/~jelmer/brz/more-cleanups/+merge/358611

Show diffs side-by-side

added added

removed removed

Lines of Context:
69
69
    def feature_name(self):
70
70
        return 'symlinks'
71
71
 
 
72
 
72
73
SymlinkFeature = _SymlinkFeature()
73
74
 
74
75
 
80
81
    def feature_name(self):
81
82
        return 'hardlinks'
82
83
 
 
84
 
83
85
HardlinkFeature = _HardlinkFeature()
84
86
 
85
87
 
91
93
    def feature_name(self):
92
94
        return 'filesystem fifos'
93
95
 
 
96
 
94
97
OsFifoFeature = _OsFifoFeature()
95
98
 
96
99
 
115
118
            # for some reason.
116
119
            return True
117
120
 
 
121
 
118
122
UnicodeFilenameFeature = _UnicodeFilenameFeature()
119
123
 
120
124
 
234
238
 
235
239
    def _probe(self):
236
240
        try:
237
 
            import ssl
 
241
            import ssl  # noqa: F401
238
242
            return True
239
243
        except ImportError:
240
244
            return False
254
258
            return True
255
259
        return False
256
260
 
 
261
 
257
262
ByteStringNamedFilesystem = _ByteStringNamedFilesystem()
258
263
 
259
264
 
265
270
            return True
266
271
        return False
267
272
 
 
273
 
268
274
UTF8Filesystem = _UTF8Filesystem()
269
275
 
270
276
 
280
286
            # We trigger SIGBREAK via a Console api so we need ctypes to
281
287
            # access the function
282
288
            try:
283
 
                import ctypes
 
289
                import ctypes  # noqa: F401
284
290
            except OSError:
285
291
                return False
286
292
        return True
303
309
            name = osutils.normpath(name)
304
310
            base, rel = osutils.split(name)
305
311
            found_rel = osutils.canonical_relpath(base, name)
306
 
            return (found_rel == rel
307
 
                    and os.path.isfile(name.upper())
308
 
                    and os.path.isfile(name.lower()))
 
312
            return (found_rel == rel and
 
313
                    os.path.isfile(name.upper()) and
 
314
                    os.path.isfile(name.lower()))
309
315
        finally:
310
316
            os.close(fileno)
311
317
            os.remove(name)
313
319
    def feature_name(self):
314
320
        return "case-insensitive case-preserving filesystem"
315
321
 
 
322
 
316
323
CaseInsCasePresFilenameFeature = _CaseInsCasePresFilenameFeature()
317
324
 
318
325
 
335
342
        else:
336
343
            root = tests.TestCaseWithMemoryTransport.TEST_ROOT
337
344
        tdir = osutils.mkdtemp(prefix='case-sensitive-probe-', suffix='',
338
 
            dir=root)
 
345
                               dir=root)
339
346
        name_a = osutils.pathjoin(tdir, 'a')
340
347
        name_A = osutils.pathjoin(tdir, 'A')
341
348
        os.mkdir(name_a)
346
353
    def feature_name(self):
347
354
        return 'case-insensitive filesystem'
348
355
 
 
356
 
349
357
CaseInsensitiveFilesystemFeature = _CaseInsensitiveFilesystemFeature()
350
358
 
351
359
 
362
370
    def feature_name(self):
363
371
        return 'case-sensitive filesystem'
364
372
 
 
373
 
365
374
# new coding style is for feature instances to be lowercase
366
375
case_sensitive_filesystem_feature = _CaseSensitiveFilesystemFeature()
367
376
 
413
422
    def feature_name(self):
414
423
        return "Filesystem treats '\\' as a directory separator."
415
424
 
 
425
 
416
426
backslashdir_feature = _BackslashDirSeparatorFeature()
417
427
 
418
428
 
422
432
    def _probe(self):
423
433
        return os.name == 'posix' and hasattr(os, 'chown')
424
434
 
 
435
 
425
436
chown_feature = _ChownFeature()
426
437
 
427
438
 
483
494
    def _probe(self):
484
495
        try:
485
496
            proc = subprocess.Popen(['strace'],
486
 
                stderr=subprocess.PIPE,
487
 
                stdout=subprocess.PIPE)
 
497
                                    stderr=subprocess.PIPE,
 
498
                                    stdout=subprocess.PIPE)
488
499
            proc.communicate()
489
500
            return True
490
501
        except OSError as e:
 
502
            import errno
491
503
            if e.errno == errno.ENOENT:
492
504
                # strace is not installed
493
505
                return False
508
520
            return False
509
521
        try:
510
522
            proc = subprocess.Popen(['attrib', '.'], stdout=subprocess.PIPE)
511
 
        except OSError as e:
 
523
        except OSError:
512
524
            return False
513
525
        return (0 == proc.wait())
514
526