~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/features.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2011-08-17 18:13:57 UTC
  • mfrom: (5268.7.29 transport-segments)
  • Revision ID: pqm@pqm.ubuntu.com-20110817181357-y5q5eth1hk8bl3om
(jelmer) Allow specifying the colocated branch to use in the branch URL,
 and retrieving the branch name using ControlDir._get_selected_branch.
 (Jelmer Vernooij)

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,
29
30
    )
30
31
 
31
32
 
140
141
                                            % (self._module, self._name))
141
142
            use_msg = ' Use %s.%s instead.' % (self._replacement_module,
142
143
                                               self._replacement_name)
143
 
            symbol_versioning.warn(depr_msg + use_msg, DeprecationWarning,
144
 
                                   stacklevel=5)
 
144
            symbol_versioning.warn(depr_msg + use_msg, DeprecationWarning)
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
 
 
295
293
        if tests.TestCaseWithMemoryTransport.TEST_ROOT is None:
296
294
            root = osutils.mkdtemp(prefix='testbzr-', suffix='.tmp')
297
295
            tests.TestCaseWithMemoryTransport.TEST_ROOT = root
348
346
apport = ModuleAvailableFeature('apport')
349
347
gpgme = ModuleAvailableFeature('gpgme')
350
348
lzma = ModuleAvailableFeature('lzma')
351
 
meliae = ModuleAvailableFeature('meliae.scanner')
 
349
meliae = ModuleAvailableFeature('meliae')
352
350
paramiko = ModuleAvailableFeature('paramiko')
353
351
pycurl = ModuleAvailableFeature('pycurl')
354
352
pywintypes = ModuleAvailableFeature('pywintypes')
 
353
sphinx = ModuleAvailableFeature('sphinx')
355
354
subunit = ModuleAvailableFeature('subunit')
356
355
testtools = ModuleAvailableFeature('testtools')
357
356
 
358
357
compiled_patiencediff_feature = ModuleAvailableFeature(
359
358
    'bzrlib._patiencediff_c')
 
359
meliae_feature = ModuleAvailableFeature('meliae.scanner')
360
360
lsprof_feature = ModuleAvailableFeature('bzrlib.lsprof')
361
361
 
362
362
 
408
408
 
409
409
 
410
410
bash_feature = ExecutableFeature('bash')
 
411
sed_feature = ExecutableFeature('sed')
411
412
diff_feature = ExecutableFeature('diff')
412
 
sed_feature = ExecutableFeature('sed')
413
 
msgmerge_feature = ExecutableFeature('msgmerge')
414
413
 
415
414
 
416
415
class _PosixPermissionsFeature(Feature):
423
422
            f = tempfile.mkstemp(prefix='bzr_perms_chk_')
424
423
            fd, name = f
425
424
            os.close(fd)
426
 
            osutils.chmod_if_possible(name, write_perms)
 
425
            os.chmod(name, write_perms)
427
426
 
428
427
            read_perms = os.stat(name).st_mode & 0777
429
428
            os.unlink(name)
494
493
win32_feature = Win32Feature()
495
494
 
496
495
 
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()
 
496
for name in ['HTTPServerFeature', 
 
497
    'HTTPSServerFeature', 'SymlinkFeature', 'HardlinkFeature',
 
498
    'OsFifoFeature', 'UnicodeFilenameFeature',
 
499
    'ByteStringNamedFilesystem', 'UTF8Filesystem',
 
500
    'BreakinFeature', 'CaseInsCasePresFilenameFeature',
 
501
    'CaseInsensitiveFilesystemFeature', 'case_sensitive_filesystem_feature',
 
502
    'posix_permissions_feature',
 
503
    ]:
 
504
    setattr(tests, name, _CompatabilityThunkFeature(
 
505
        symbol_versioning.deprecated_in((2, 5, 0)),
 
506
        'bzrlib.tests', name,
 
507
        name, 'bzrlib.tests.features'))
 
508
 
 
509
 
 
510
for (old_name, new_name) in [
 
511
    ('UnicodeFilename', 'UnicodeFilenameFeature'),
 
512
    ]:
 
513
    setattr(tests, name, _CompatabilityThunkFeature(
 
514
        symbol_versioning.deprecated_in((2, 5, 0)),
 
515
        'bzrlib.tests', old_name,
 
516
        new_name, 'bzrlib.tests.features'))