/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/__init__.py

  • Committer: Gustav Hartvigsson
  • Date: 2021-01-09 21:36:27 UTC
  • Revision ID: gustav.hartvigsson@gmail.com-20210109213627-h1xwcutzy9m7a99b
Added 'Case Preserving Working Tree Use Cases' from Canonical Wiki

* Addod a page from the Canonical Bazaar wiki
  with information on the scmeatics of case
  perserving filesystems an a case insensitive
  filesystem works.
  
  * Needs re-work, but this will do as it is the
    same inforamoton as what was on the linked
    page in the currint documentation.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
"""Testing framework extensions"""
18
18
 
19
 
from __future__ import absolute_import
20
 
 
21
19
# NOTE: Some classes in here use camelCaseNaming() rather than
22
20
# underscore_naming().  That's for consistency with unittest; it's not the
23
21
# general style of breezy.  Please continue that consistency when adding e.g.
94
92
except ImportError:
95
93
    # lsprof not available
96
94
    pass
97
 
from ..sixish import (
98
 
    int2byte,
99
 
    PY3,
100
 
    string_types,
101
 
    text_type,
102
 
    )
103
95
from ..bzr.smart import client, request
104
96
from ..transport import (
105
97
    memory,
155
147
    'BZREMAIL': None,  # may still be present in the environment
156
148
    'EMAIL': 'jrandom@example.com',  # set EMAIL as brz does not guess
157
149
    'BRZ_PROGRESS_BAR': None,
158
 
    # This should trap leaks to ~/.brz.log. This occurs when tests use TestCase
159
 
    # as a base class instead of TestCaseInTempDir. Tests inheriting from
160
 
    # TestCase should not use disk resources, BRZ_LOG is one.
 
150
    # Trap leaks to $XDG_CACHE_HOME/breezy/brz.log. This occurs when tests use
 
151
    # TestCase as a base class instead of TestCaseInTempDir. Tests inheriting
 
152
    # from TestCase should not use disk resources, BRZ_LOG is one.
161
153
    'BRZ_LOG': '/you-should-use-TestCaseInTempDir-if-you-need-a-log-file',
162
154
    'BRZ_PLUGIN_PATH': '-site',
163
155
    'BRZ_DISABLE_PLUGINS': None,
1331
1323
            return
1332
1324
        if message is None:
1333
1325
            message = "texts not equal:\n"
1334
 
        if a + ('\n' if isinstance(a, text_type) else b'\n') == b:
 
1326
        if a + ('\n' if isinstance(a, str) else b'\n') == b:
1335
1327
            message = 'first string is missing a final newline.\n'
1336
 
        if a == b + ('\n' if isinstance(b, text_type) else b'\n'):
 
1328
        if a == b + ('\n' if isinstance(b, str) else b'\n'):
1337
1329
            message = 'second string is missing a final newline.\n'
1338
1330
        raise AssertionError(message
1339
 
                             + self._ndiff_strings(a, b))
 
1331
                             + self._ndiff_strings(
 
1332
                                 a if isinstance(a, str) else a.decode(),
 
1333
                                 b if isinstance(b, str) else b.decode()))
1340
1334
 
1341
1335
    def assertEqualMode(self, mode, mode_test):
1342
1336
        self.assertEqual(mode, mode_test,
1554
1548
    def assertPathExists(self, path):
1555
1549
        """Fail unless path or paths, which may be abs or relative, exist."""
1556
1550
        # TODO(jelmer): Clean this up for pad.lv/1696545
1557
 
        if not isinstance(path, (bytes, str, text_type)):
 
1551
        if not isinstance(path, (bytes, str)):
1558
1552
            for p in path:
1559
1553
                self.assertPathExists(p)
1560
1554
        else:
1563
1557
 
1564
1558
    def assertPathDoesNotExist(self, path):
1565
1559
        """Fail if path or paths, which may be abs or relative, exist."""
1566
 
        if not isinstance(path, (str, text_type)):
 
1560
        if not isinstance(path, (str, str)):
1567
1561
            for p in path:
1568
1562
                self.assertPathDoesNotExist(p)
1569
1563
        else:
1938
1932
 
1939
1933
        self.log('run brz: %r', args)
1940
1934
 
1941
 
        if PY3:
1942
 
            self._last_cmd_stdout = stdout
1943
 
            self._last_cmd_stderr = stderr
1944
 
        else:
1945
 
            self._last_cmd_stdout = codecs.getwriter(encoding)(stdout)
1946
 
            self._last_cmd_stderr = codecs.getwriter(encoding)(stderr)
 
1935
        self._last_cmd_stdout = stdout
 
1936
        self._last_cmd_stderr = stderr
1947
1937
 
1948
1938
        old_ui_factory = ui.ui_factory
1949
1939
        ui.ui_factory = ui_testing.TestUIFactory(
2003
1993
        :keyword error_regexes: A list of expected error messages.  If
2004
1994
            specified they must be seen in the error output of the command.
2005
1995
        """
2006
 
        if isinstance(args, string_types):
 
1996
        if isinstance(args, str):
2007
1997
            args = shlex.split(args)
2008
1998
 
2009
1999
        if encoding is None:
2010
2000
            encoding = osutils.get_user_encoding()
2011
2001
 
2012
 
        if sys.version_info[0] == 2:
2013
 
            wrapped_stdout = stdout = ui_testing.BytesIOWithEncoding()
2014
 
            wrapped_stderr = stderr = ui_testing.BytesIOWithEncoding()
2015
 
            stdout.encoding = stderr.encoding = encoding
2016
 
 
2017
 
            # FIXME: don't call into logging here
2018
 
            handler = trace.EncodedStreamHandler(
2019
 
                stderr, errors="replace")
2020
 
        else:
2021
 
            stdout = BytesIO()
2022
 
            stderr = BytesIO()
2023
 
            wrapped_stdout = TextIOWrapper(stdout, encoding)
2024
 
            wrapped_stderr = TextIOWrapper(stderr, encoding)
2025
 
            handler = logging.StreamHandler(wrapped_stderr)
 
2002
        stdout = BytesIO()
 
2003
        stderr = BytesIO()
 
2004
        wrapped_stdout = TextIOWrapper(stdout, encoding)
 
2005
        wrapped_stderr = TextIOWrapper(stderr, encoding)
 
2006
        handler = logging.StreamHandler(wrapped_stderr)
2026
2007
        handler.setLevel(logging.INFO)
2027
2008
 
2028
2009
        logger = logging.getLogger('')
2035
2016
        finally:
2036
2017
            logger.removeHandler(handler)
2037
2018
 
2038
 
        if PY3:
2039
 
            wrapped_stdout.flush()
2040
 
            wrapped_stderr.flush()
 
2019
        wrapped_stdout.flush()
 
2020
        wrapped_stderr.flush()
2041
2021
 
2042
2022
        out = stdout.getvalue()
2043
2023
        err = stderr.getvalue()
2086
2066
        :keyword error_regexes: A list of expected error messages.  If
2087
2067
            specified they must be seen in the error output of the command.
2088
2068
        """
2089
 
        if isinstance(args, string_types):
 
2069
        if isinstance(args, str):
2090
2070
            args = shlex.split(args)
2091
2071
 
2092
2072
        if encoding is None:
2093
2073
            encoding = osutils.get_user_encoding()
2094
2074
 
2095
 
        if sys.version_info[0] == 2:
2096
 
            stdout = ui_testing.BytesIOWithEncoding()
2097
 
            stderr = ui_testing.BytesIOWithEncoding()
2098
 
            stdout.encoding = stderr.encoding = encoding
2099
 
            # FIXME: don't call into logging here
2100
 
            handler = trace.EncodedStreamHandler(
2101
 
                stderr, errors="replace")
2102
 
        else:
2103
 
            stdout = ui_testing.StringIOWithEncoding()
2104
 
            stderr = ui_testing.StringIOWithEncoding()
2105
 
            stdout.encoding = stderr.encoding = encoding
2106
 
            handler = logging.StreamHandler(stream=stderr)
 
2075
        stdout = ui_testing.StringIOWithEncoding()
 
2076
        stderr = ui_testing.StringIOWithEncoding()
 
2077
        stdout.encoding = stderr.encoding = encoding
 
2078
        handler = logging.StreamHandler(stream=stderr)
2107
2079
        handler.setLevel(logging.INFO)
2108
2080
 
2109
2081
        logger = logging.getLogger('')
2188
2160
        if len(args) == 1:
2189
2161
            if isinstance(args[0], list):
2190
2162
                args = args[0]
2191
 
            elif isinstance(args[0], (str, text_type)):
 
2163
            elif isinstance(args[0], str):
2192
2164
                args = list(shlex.split(args[0]))
2193
2165
        else:
2194
2166
            raise ValueError("passing varargs to run_bzr_subprocess")
2393
2365
            if getattr(self, "_log_file", None) is not None:
2394
2366
                stdout = self._log_file
2395
2367
            else:
2396
 
                if sys.version_info[0] == 2:
2397
 
                    stdout = BytesIO()
2398
 
                else:
2399
 
                    stdout = StringIO()
 
2368
                stdout = StringIO()
2400
2369
        if stderr is None:
2401
2370
            if getattr(self, "_log_file", None is not None):
2402
2371
                stderr = self._log_file
2403
2372
            else:
2404
 
                if sys.version_info[0] == 2:
2405
 
                    stderr = BytesIO()
2406
 
                else:
2407
 
                    stderr = StringIO()
 
2373
                stderr = StringIO()
2408
2374
        real_stdin = sys.stdin
2409
2375
        real_stdout = sys.stdout
2410
2376
        real_stderr = sys.stderr
2464
2430
        self.stack = ''.join(traceback.format_list(stack))
2465
2431
 
2466
2432
    def __str__(self):
2467
 
        return self.call.method
 
2433
        return self.call.method.decode('utf-8')
2468
2434
 
2469
2435
    def __repr__(self):
2470
 
        return self.call.method
 
2436
        return self.call.method.decode('utf-8')
2471
2437
 
2472
2438
    def stack(self):
2473
2439
        return self.stack
2684
2650
        """
2685
2651
        root = TestCaseWithMemoryTransport.TEST_ROOT
2686
2652
        try:
2687
 
            # Make sure we get a readable and accessible home for .brz.log
 
2653
            # Make sure we get a readable and accessible home for brz.log
2688
2654
            # and/or config files, and not fallback to weird defaults (see
2689
2655
            # http://pad.lv/825027).
2690
2656
            self.assertIs(None, os.environ.get('BRZ_HOME', None))
2691
2657
            os.environ['BRZ_HOME'] = root
2692
 
            wt = controldir.ControlDir.create_standalone_workingtree(root)
 
2658
            from breezy.bzr.bzrdir import BzrDirMetaFormat1
 
2659
            wt = controldir.ControlDir.create_standalone_workingtree(
 
2660
                root, format=BzrDirMetaFormat1())
2693
2661
            del os.environ['BRZ_HOME']
2694
2662
        except Exception as e:
2695
2663
            self.fail("Fail to initialize the safety net: %r\n" % (e,))
2816
2784
 
2817
2785
    def overrideEnvironmentForTesting(self):
2818
2786
        test_home_dir = self.test_home_dir
2819
 
        if not PY3 and isinstance(test_home_dir, text_type):
2820
 
            test_home_dir = test_home_dir.encode(sys.getfilesystemencoding())
2821
2787
        self.overrideEnv('HOME', test_home_dir)
2822
2788
        self.overrideEnv('BRZ_HOME', test_home_dir)
2823
2789
        self.overrideEnv('GNUPGHOME', os.path.join(test_home_dir, '.gnupg'))
2958
2924
        if transport is None or transport.is_readonly():
2959
2925
            transport = _mod_transport.get_transport_from_path(".")
2960
2926
        for name in shape:
2961
 
            self.assertIsInstance(name, (str, text_type))
 
2927
            self.assertIsInstance(name, str)
2962
2928
            if name[-1] == '/':
2963
2929
                transport.mkdir(urlutils.escape(name[:-1]))
2964
2930
            else:
2978
2944
        """Assert whether path or paths are in the WorkingTree"""
2979
2945
        if tree is None:
2980
2946
            tree = workingtree.WorkingTree.open(root_path)
2981
 
        if not isinstance(path, (str, text_type)):
 
2947
        if not isinstance(path, str):
2982
2948
            for p in path:
2983
2949
                self.assertInWorkingTree(p, tree=tree)
2984
2950
        else:
2989
2955
        """Assert whether path or paths are not in the WorkingTree"""
2990
2956
        if tree is None:
2991
2957
            tree = workingtree.WorkingTree.open(root_path)
2992
 
        if not isinstance(path, (str, text_type)):
 
2958
        if not isinstance(path, str):
2993
2959
            for p in path:
2994
2960
                self.assertNotInWorkingTree(p, tree=tree)
2995
2961
        else:
3404
3370
 
3405
3371
def fork_decorator(suite):
3406
3372
    if getattr(os, "fork", None) is None:
3407
 
        raise errors.BzrCommandError("platform does not support fork,"
 
3373
        raise errors.CommandError("platform does not support fork,"
3408
3374
                                     " try --parallel=subprocess instead.")
3409
3375
    concurrency = osutils.local_concurrency()
3410
3376
    if concurrency == 1:
3612
3578
        pid = os.fork()
3613
3579
        if pid == 0:
3614
3580
            try:
3615
 
                stream = os.fdopen(c2pwrite, 'wb', 1)
 
3581
                stream = os.fdopen(c2pwrite, 'wb', 0)
3616
3582
                workaround_zealous_crypto_random()
3617
3583
                try:
3618
3584
                    import coverage
3635
3601
                # The traceback is formatted to a string and written in one go
3636
3602
                # to avoid interleaving lines from multiple failing children.
3637
3603
                tb = traceback.format_exc()
3638
 
                if isinstance(tb, text_type):
 
3604
                if isinstance(tb, str):
3639
3605
                    tb = tb.encode('utf-8')
3640
3606
                try:
3641
3607
                    stream.write(tb)
3645
3611
            os._exit(0)
3646
3612
        else:
3647
3613
            os.close(c2pwrite)
3648
 
            stream = os.fdopen(c2pread, 'rb', 1)
 
3614
            stream = os.fdopen(c2pread, 'rb', 0)
3649
3615
            test = TestInOtherProcess(stream, pid)
3650
3616
            result.append(test)
3651
3617
    return result
3973
3939
        try:
3974
3940
            parts[0] = self.get(parts[0])
3975
3941
        except KeyError:
3976
 
            raise errors.BzrCommandError(
 
3942
            raise errors.CommandError(
3977
3943
                '%s is not a known test prefix alias' % parts[0])
3978
3944
        return '.'.join(parts)
3979
3945
 
3990
3956
test_prefix_alias_registry.register('bd', 'breezy.doc')
3991
3957
test_prefix_alias_registry.register('bu', 'breezy.utils')
3992
3958
test_prefix_alias_registry.register('bt', 'breezy.tests')
 
3959
test_prefix_alias_registry.register('bgt', 'breezy.git.tests')
 
3960
test_prefix_alias_registry.register('bbt', 'breezy.bzr.tests')
3993
3961
test_prefix_alias_registry.register('bb', 'breezy.tests.blackbox')
3994
3962
test_prefix_alias_registry.register('bp', 'breezy.plugins')
3995
3963
 
3997
3965
def _test_suite_testmod_names():
3998
3966
    """Return the standard list of test module names to test."""
3999
3967
    return [
4000
 
        'breezy.git.tests.test_blackbox',
4001
 
        'breezy.git.tests.test_builder',
4002
 
        'breezy.git.tests.test_branch',
4003
 
        'breezy.git.tests.test_cache',
4004
 
        'breezy.git.tests.test_dir',
4005
 
        'breezy.git.tests.test_fetch',
4006
 
        'breezy.git.tests.test_git_remote_helper',
4007
 
        'breezy.git.tests.test_mapping',
4008
 
        'breezy.git.tests.test_memorytree',
4009
 
        'breezy.git.tests.test_object_store',
4010
 
        'breezy.git.tests.test_pristine_tar',
4011
 
        'breezy.git.tests.test_push',
4012
 
        'breezy.git.tests.test_remote',
4013
 
        'breezy.git.tests.test_repository',
4014
 
        'breezy.git.tests.test_refs',
4015
 
        'breezy.git.tests.test_revspec',
4016
 
        'breezy.git.tests.test_roundtrip',
4017
 
        'breezy.git.tests.test_server',
4018
 
        'breezy.git.tests.test_transportgit',
4019
 
        'breezy.git.tests.test_unpeel_map',
4020
 
        'breezy.git.tests.test_urls',
4021
 
        'breezy.git.tests.test_workingtree',
 
3968
        'breezy.bzr.tests',
 
3969
        'breezy.git.tests',
4022
3970
        'breezy.tests.blackbox',
4023
3971
        'breezy.tests.commands',
4024
3972
        'breezy.tests.per_branch',
4025
 
        'breezy.tests.per_bzrdir',
4026
3973
        'breezy.tests.per_controldir',
4027
3974
        'breezy.tests.per_controldir_colo',
4028
3975
        'breezy.tests.per_foreign_vcs',
4029
3976
        'breezy.tests.per_interrepository',
4030
3977
        'breezy.tests.per_intertree',
4031
 
        'breezy.tests.per_inventory',
4032
3978
        'breezy.tests.per_interbranch',
4033
3979
        'breezy.tests.per_lock',
4034
3980
        'breezy.tests.per_merger',
4035
3981
        'breezy.tests.per_transport',
4036
3982
        'breezy.tests.per_tree',
4037
 
        'breezy.tests.per_pack_repository',
4038
3983
        'breezy.tests.per_repository',
4039
 
        'breezy.tests.per_repository_chk',
4040
3984
        'breezy.tests.per_repository_reference',
4041
 
        'breezy.tests.per_repository_vf',
4042
3985
        'breezy.tests.per_uifactory',
4043
 
        'breezy.tests.per_versionedfile',
4044
3986
        'breezy.tests.per_workingtree',
4045
3987
        'breezy.tests.test__annotator',
4046
3988
        'breezy.tests.test__bencode',
4047
 
        'breezy.tests.test__btree_serializer',
4048
 
        'breezy.tests.test__chk_map',
4049
 
        'breezy.tests.test__dirstate_helpers',
4050
 
        'breezy.tests.test__groupcompress',
4051
3989
        'breezy.tests.test__known_graph',
4052
 
        'breezy.tests.test__rio',
4053
3990
        'breezy.tests.test__simple_set',
4054
3991
        'breezy.tests.test__static_tuple',
4055
3992
        'breezy.tests.test__walkdirs_win32',
4061
3998
        'breezy.tests.test_bisect_multi',
4062
3999
        'breezy.tests.test_branch',
4063
4000
        'breezy.tests.test_branchbuilder',
4064
 
        'breezy.tests.test_btree_index',
4065
4001
        'breezy.tests.test_bugtracker',
4066
 
        'breezy.tests.test_bundle',
4067
 
        'breezy.tests.test_bzrdir',
4068
4002
        'breezy.tests.test__chunks_to_lines',
4069
4003
        'breezy.tests.test_cache_utf8',
4070
 
        'breezy.tests.test_chk_map',
4071
 
        'breezy.tests.test_chk_serializer',
4072
4004
        'breezy.tests.test_chunk_writer',
4073
4005
        'breezy.tests.test_clean_tree',
4074
 
        'breezy.tests.test_cleanup',
4075
4006
        'breezy.tests.test_cmdline',
4076
4007
        'breezy.tests.test_commands',
4077
4008
        'breezy.tests.test_commit',
4078
4009
        'breezy.tests.test_commit_merge',
4079
4010
        'breezy.tests.test_config',
 
4011
        'breezy.tests.test_bedding',
4080
4012
        'breezy.tests.test_conflicts',
4081
4013
        'breezy.tests.test_controldir',
4082
4014
        'breezy.tests.test_counted_lock',
4086
4018
        'breezy.tests.test_debug',
4087
4019
        'breezy.tests.test_diff',
4088
4020
        'breezy.tests.test_directory_service',
4089
 
        'breezy.tests.test_dirstate',
 
4021
        'breezy.tests.test_dirty_tracker',
4090
4022
        'breezy.tests.test_email_message',
4091
4023
        'breezy.tests.test_eol_filters',
4092
4024
        'breezy.tests.test_errors',
4103
4035
        'breezy.tests.test_filter_tree',
4104
4036
        'breezy.tests.test_foreign',
4105
4037
        'breezy.tests.test_generate_docs',
4106
 
        'breezy.tests.test_generate_ids',
4107
4038
        'breezy.tests.test_globbing',
4108
4039
        'breezy.tests.test_gpg',
4109
4040
        'breezy.tests.test_graph',
4110
 
        'breezy.tests.test_groupcompress',
 
4041
        'breezy.tests.test_grep',
4111
4042
        'breezy.tests.test_hashcache',
4112
4043
        'breezy.tests.test_help',
4113
4044
        'breezy.tests.test_hooks',
4118
4049
        'breezy.tests.test_i18n',
4119
4050
        'breezy.tests.test_identitymap',
4120
4051
        'breezy.tests.test_ignores',
4121
 
        'breezy.tests.test_index',
4122
4052
        'breezy.tests.test_import_tariff',
4123
4053
        'breezy.tests.test_info',
4124
 
        'breezy.tests.test_inv',
4125
 
        'breezy.tests.test_inventory_delta',
4126
 
        'breezy.tests.test_knit',
4127
4054
        'breezy.tests.test_lazy_import',
4128
4055
        'breezy.tests.test_lazy_regex',
4129
4056
        'breezy.tests.test_library_state',
 
4057
        'breezy.tests.test_location',
4130
4058
        'breezy.tests.test_lock',
4131
4059
        'breezy.tests.test_lockable_files',
4132
4060
        'breezy.tests.test_lockdir',
4135
4063
        'breezy.tests.test_lsprof',
4136
4064
        'breezy.tests.test_mail_client',
4137
4065
        'breezy.tests.test_matchers',
 
4066
        'breezy.tests.test_memorybranch',
4138
4067
        'breezy.tests.test_memorytree',
4139
4068
        'breezy.tests.test_merge',
4140
4069
        'breezy.tests.test_merge3',
 
4070
        'breezy.tests.test_mergeable',
4141
4071
        'breezy.tests.test_merge_core',
4142
4072
        'breezy.tests.test_merge_directive',
4143
4073
        'breezy.tests.test_mergetools',
4144
4074
        'breezy.tests.test_missing',
4145
4075
        'breezy.tests.test_msgeditor',
4146
4076
        'breezy.tests.test_multiparent',
 
4077
        'breezy.tests.test_multiwalker',
4147
4078
        'breezy.tests.test_mutabletree',
4148
4079
        'breezy.tests.test_nonascii',
4149
4080
        'breezy.tests.test_options',
4150
4081
        'breezy.tests.test_osutils',
4151
4082
        'breezy.tests.test_osutils_encodings',
4152
 
        'breezy.tests.test_pack',
4153
4083
        'breezy.tests.test_patch',
4154
4084
        'breezy.tests.test_patches',
4155
4085
        'breezy.tests.test_permissions',
4156
4086
        'breezy.tests.test_plugins',
4157
4087
        'breezy.tests.test_progress',
 
4088
        'breezy.tests.test_propose',
4158
4089
        'breezy.tests.test_pyutils',
4159
 
        'breezy.tests.test_read_bundle',
4160
4090
        'breezy.tests.test_reconcile',
4161
4091
        'breezy.tests.test_reconfigure',
4162
4092
        'breezy.tests.test_registry',
4163
 
        'breezy.tests.test_remote',
4164
4093
        'breezy.tests.test_rename_map',
4165
 
        'breezy.tests.test_repository',
4166
4094
        'breezy.tests.test_revert',
4167
4095
        'breezy.tests.test_revision',
4168
4096
        'breezy.tests.test_revisionspec',
4169
4097
        'breezy.tests.test_revisiontree',
4170
4098
        'breezy.tests.test_rio',
 
4099
        'breezy.tests.test__rio',
4171
4100
        'breezy.tests.test_rules',
4172
4101
        'breezy.tests.test_url_policy_open',
4173
4102
        'breezy.tests.test_sampler',
4174
4103
        'breezy.tests.test_scenarios',
4175
4104
        'breezy.tests.test_script',
4176
4105
        'breezy.tests.test_selftest',
4177
 
        'breezy.tests.test_serializer',
4178
4106
        'breezy.tests.test_setup',
4179
4107
        'breezy.tests.test_sftp_transport',
4180
4108
        'breezy.tests.test_shelf',
4181
4109
        'breezy.tests.test_shelf_ui',
4182
 
        'breezy.tests.test_smart',
4183
4110
        'breezy.tests.test_smart_add',
4184
 
        'breezy.tests.test_smart_request',
4185
 
        'breezy.tests.test_smart_signals',
4186
 
        'breezy.tests.test_smart_transport',
4187
4111
        'breezy.tests.test_smtp_connection',
4188
4112
        'breezy.tests.test_source',
4189
4113
        'breezy.tests.test_ssh_transport',
4194
4118
        'breezy.tests.test_symbol_versioning',
4195
4119
        'breezy.tests.test_tag',
4196
4120
        'breezy.tests.test_test_server',
4197
 
        'breezy.tests.test_testament',
4198
4121
        'breezy.tests.test_textfile',
4199
4122
        'breezy.tests.test_textmerge',
4200
4123
        'breezy.tests.test_cethread',
4218
4141
        'breezy.tests.test_utextwrap',
4219
4142
        'breezy.tests.test_version',
4220
4143
        'breezy.tests.test_version_info',
4221
 
        'breezy.tests.test_versionedfile',
4222
 
        'breezy.tests.test_vf_search',
4223
4144
        'breezy.tests.test_views',
4224
 
        'breezy.tests.test_weave',
4225
4145
        'breezy.tests.test_whitebox',
4226
4146
        'breezy.tests.test_win32utils',
 
4147
        'breezy.tests.test_workspace',
4227
4148
        'breezy.tests.test_workingtree',
4228
 
        'breezy.tests.test_workingtree_4',
4229
4149
        'breezy.tests.test_wsgi',
4230
 
        'breezy.tests.test_xml',
4231
4150
        ]
4232
4151
 
4233
4152
 
4301
4220
    # modules building their suite with loadTestsFromModuleNames
4302
4221
    suite.addTest(loader.loadTestsFromModuleNames(_test_suite_testmod_names()))
4303
4222
 
4304
 
    if not PY3:
4305
 
        suite.addTest(loader.loadTestsFromModuleNames(['breezy.doc']))
 
4223
    suite.addTest(loader.loadTestsFromModuleNames(['breezy.doc']))
4306
4224
 
4307
 
        # It's pretty much impossible to write readable doctests that work on
4308
 
        # both Python 2 and Python 3 because of their overreliance on
4309
 
        # consistent repr() return values.
4310
 
        # For now, just run doctests on Python 2 so we now they haven't broken.
4311
 
        for mod in _test_suite_modules_to_doctest():
4312
 
            if not interesting_module(mod):
4313
 
                # No tests to keep here, move along
4314
 
                continue
4315
 
            try:
4316
 
                # note that this really does mean "report only" -- doctest
4317
 
                # still runs the rest of the examples
4318
 
                doc_suite = IsolatedDocTestSuite(
4319
 
                    mod, optionflags=doctest.REPORT_ONLY_FIRST_FAILURE)
4320
 
            except ValueError as e:
4321
 
                print('**failed to get doctest for: %s\n%s' % (mod, e))
4322
 
                raise
4323
 
            if len(doc_suite._tests) == 0:
4324
 
                raise errors.BzrError("no doctests found in %s" % (mod,))
4325
 
            suite.addTest(doc_suite)
 
4225
    for mod in _test_suite_modules_to_doctest():
 
4226
        if not interesting_module(mod):
 
4227
            # No tests to keep here, move along
 
4228
            continue
 
4229
        try:
 
4230
            # note that this really does mean "report only" -- doctest
 
4231
            # still runs the rest of the examples
 
4232
            doc_suite = IsolatedDocTestSuite(
 
4233
                mod, optionflags=doctest.REPORT_ONLY_FIRST_FAILURE)
 
4234
        except ValueError as e:
 
4235
            print('**failed to get doctest for: %s\n%s' % (mod, e))
 
4236
            raise
 
4237
        if len(doc_suite._tests) == 0:
 
4238
            raise errors.BzrError("no doctests found in %s" % (mod,))
 
4239
        suite.addTest(doc_suite)
4326
4240
 
4327
4241
    default_encoding = sys.getdefaultencoding()
4328
4242
    for name, plugin in _mod_plugin.plugins().items():
4484
4398
    return new_test
4485
4399
 
4486
4400
 
 
4401
 
4487
4402
def permute_tests_for_extension(standard_tests, loader, py_module_name,
4488
4403
                                ext_module_name):
4489
4404
    """Helper for permutating tests against an extension module.
4517
4432
    if feature.available():
4518
4433
        scenarios.append(('C', {'module': feature.module}))
4519
4434
    else:
4520
 
        # the compiled module isn't available, so we add a failing test
4521
4435
        class FailWithoutFeature(TestCase):
 
4436
            def id(self):
 
4437
                return ext_module_name + '.' + super(FailWithoutFeature, self).id()
4522
4438
            def test_fail(self):
4523
4439
                self.requireFeature(feature)
 
4440
        # the compiled module isn't available, so we add a failing test
4524
4441
        suite.addTest(loader.loadTestsFromTestCase(FailWithoutFeature))
4525
4442
    result = multiply_tests(standard_tests, scenarios, suite)
4526
4443
    return result, feature
4579
4496
    for given encoding.
4580
4497
    """
4581
4498
    for i in range(128, 256):
4582
 
        char = int2byte(i)
 
4499
        char = bytes([i])
4583
4500
        try:
4584
4501
            char.decode(encoding)
4585
4502
        except UnicodeDecodeError: