~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/features.py

  • Committer: Patch Queue Manager
  • Date: 2016-01-31 13:36:59 UTC
  • mfrom: (6613.1.5 1538480-match-hostname)
  • Revision ID: pqm@pqm.ubuntu.com-20160131133659-ouy92ee2wlv9xz8m
(vila) Use ssl.match_hostname instead of our own. (Vincent Ladeuil)

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
from bzrlib import (
27
27
    osutils,
28
28
    symbol_versioning,
29
 
    tests,
30
29
    )
31
30
 
32
31
 
141
140
                                            % (self._module, self._name))
142
141
            use_msg = ' Use %s.%s instead.' % (self._replacement_module,
143
142
                                               self._replacement_name)
144
 
            symbol_versioning.warn(depr_msg + use_msg, DeprecationWarning)
 
143
            symbol_versioning.warn(depr_msg + use_msg, DeprecationWarning,
 
144
                                   stacklevel=5)
145
145
            # Import the new feature and use it as a replacement for the
146
146
            # deprecated one.
147
147
            self._feature = pyutils.get_named_object(
290
290
        if CaseInsCasePresFilenameFeature.available():
291
291
            return False
292
292
 
 
293
        from bzrlib import tests
 
294
 
293
295
        if tests.TestCaseWithMemoryTransport.TEST_ROOT is None:
294
296
            root = osutils.mkdtemp(prefix='testbzr-', suffix='.tmp')
295
297
            tests.TestCaseWithMemoryTransport.TEST_ROOT = root
350
352
paramiko = ModuleAvailableFeature('paramiko')
351
353
pycurl = ModuleAvailableFeature('pycurl')
352
354
pywintypes = ModuleAvailableFeature('pywintypes')
353
 
sphinx = ModuleAvailableFeature('sphinx')
354
355
subunit = ModuleAvailableFeature('subunit')
355
356
testtools = ModuleAvailableFeature('testtools')
356
357
 
407
408
 
408
409
 
409
410
bash_feature = ExecutableFeature('bash')
 
411
diff_feature = ExecutableFeature('diff')
410
412
sed_feature = ExecutableFeature('sed')
411
 
diff_feature = ExecutableFeature('diff')
 
413
msgmerge_feature = ExecutableFeature('msgmerge')
412
414
 
413
415
 
414
416
class _PosixPermissionsFeature(Feature):
421
423
            f = tempfile.mkstemp(prefix='bzr_perms_chk_')
422
424
            fd, name = f
423
425
            os.close(fd)
424
 
            os.chmod(name, write_perms)
 
426
            osutils.chmod_if_possible(name, write_perms)
425
427
 
426
428
            read_perms = os.stat(name).st_mode & 0777
427
429
            os.unlink(name)
492
494
win32_feature = Win32Feature()
493
495
 
494
496
 
495
 
for name in ['HTTPServerFeature', 
496
 
    'HTTPSServerFeature', 'SymlinkFeature', 'HardlinkFeature',
497
 
    'OsFifoFeature', 'UnicodeFilenameFeature',
498
 
    'ByteStringNamedFilesystem', 'UTF8Filesystem',
499
 
    'BreakinFeature', 'CaseInsCasePresFilenameFeature',
500
 
    'CaseInsensitiveFilesystemFeature', 'case_sensitive_filesystem_feature',
501
 
    'posix_permissions_feature',
502
 
    ]:
503
 
    setattr(tests, name, _CompatabilityThunkFeature(
504
 
        symbol_versioning.deprecated_in((2, 5, 0)),
505
 
        'bzrlib.tests', name,
506
 
        name, 'bzrlib.tests.features'))
507
 
 
508
 
 
509
 
for (old_name, new_name) in [
510
 
    ('UnicodeFilename', 'UnicodeFilenameFeature'),
511
 
    ]:
512
 
    setattr(tests, name, _CompatabilityThunkFeature(
513
 
        symbol_versioning.deprecated_in((2, 5, 0)),
514
 
        'bzrlib.tests', old_name,
515
 
        new_name, 'bzrlib.tests.features'))
 
497
class _ColorFeature(Feature):
 
498
 
 
499
    def _probe(self):
 
500
        from bzrlib._termcolor import allow_color
 
501
        return allow_color()
 
502
 
 
503
    def feature_name(self):
 
504
        return "Terminal supports color."
 
505
 
 
506
ColorFeature = _ColorFeature()