/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: Jelmer Vernooij
  • Date: 2019-03-04 00:16:27 UTC
  • mfrom: (7293 work)
  • mto: This revision was merged to the branch mainline in revision 7318.
  • Revision ID: jelmer@jelmer.uk-20190304001627-v6u7o6pf97tukhek
Merge trunk.

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
 
393
402
pywintypes = ModuleAvailableFeature('pywintypes')
394
403
subunit = ModuleAvailableFeature('subunit')
395
404
testtools = ModuleAvailableFeature('testtools')
 
405
flake8 = ModuleAvailableFeature('flake8.api.legacy')
396
406
 
397
407
compiled_patiencediff_feature = ModuleAvailableFeature(
398
408
    'breezy._patiencediff_c')
399
409
lsprof_feature = ModuleAvailableFeature('breezy.lsprof')
 
410
pkg_resources_feature = ModuleAvailableFeature('pkg_resources')
400
411
 
401
412
 
402
413
class _BackslashDirSeparatorFeature(Feature):
412
423
    def feature_name(self):
413
424
        return "Filesystem treats '\\' as a directory separator."
414
425
 
 
426
 
415
427
backslashdir_feature = _BackslashDirSeparatorFeature()
416
428
 
417
429
 
421
433
    def _probe(self):
422
434
        return os.name == 'posix' and hasattr(os, 'chown')
423
435
 
 
436
 
424
437
chown_feature = _ChownFeature()
425
438
 
426
439
 
482
495
    def _probe(self):
483
496
        try:
484
497
            proc = subprocess.Popen(['strace'],
485
 
                stderr=subprocess.PIPE,
486
 
                stdout=subprocess.PIPE)
 
498
                                    stderr=subprocess.PIPE,
 
499
                                    stdout=subprocess.PIPE)
487
500
            proc.communicate()
488
501
            return True
489
502
        except OSError as e:
 
503
            import errno
490
504
            if e.errno == errno.ENOENT:
491
505
                # strace is not installed
492
506
                return False
507
521
            return False
508
522
        try:
509
523
            proc = subprocess.Popen(['attrib', '.'], stdout=subprocess.PIPE)
510
 
        except OSError as e:
 
524
        except OSError:
511
525
            return False
512
526
        return (0 == proc.wait())
513
527