108
111
default_transport = LocalURLServer
114
MODULES_TO_DOCTEST = [
124
bzrlib.version_info_formats.format_custom,
125
# quoted to avoid module-loading circularity
130
def packages_to_test():
131
"""Return a list of packages to test.
133
The packages are not globally imported so that import failures are
134
triggered when running selftest, not when importing the command.
137
import bzrlib.tests.blackbox
138
import bzrlib.tests.branch_implementations
139
import bzrlib.tests.bzrdir_implementations
140
import bzrlib.tests.commands
141
import bzrlib.tests.interrepository_implementations
142
import bzrlib.tests.interversionedfile_implementations
143
import bzrlib.tests.intertree_implementations
144
import bzrlib.tests.inventory_implementations
145
import bzrlib.tests.per_lock
146
import bzrlib.tests.repository_implementations
147
import bzrlib.tests.revisionstore_implementations
148
import bzrlib.tests.tree_implementations
149
import bzrlib.tests.workingtree_implementations
152
bzrlib.tests.blackbox,
153
bzrlib.tests.branch_implementations,
154
bzrlib.tests.bzrdir_implementations,
155
bzrlib.tests.commands,
156
bzrlib.tests.interrepository_implementations,
157
bzrlib.tests.interversionedfile_implementations,
158
bzrlib.tests.intertree_implementations,
159
bzrlib.tests.inventory_implementations,
160
bzrlib.tests.per_lock,
161
bzrlib.tests.repository_implementations,
162
bzrlib.tests.revisionstore_implementations,
163
bzrlib.tests.tree_implementations,
164
bzrlib.tests.workingtree_implementations,
111
168
class ExtendedTestResult(unittest._TextTestResult):
112
169
"""Accepts, reports and accumulates the results of running tests.
362
414
self.pb.update('[test 0/%d] starting...' % (self.num_tests))
364
416
def _progress_prefix_text(self):
365
# the longer this text, the less space we have to show the test
367
a = '[%d' % self.count # total that have been run
368
# tests skipped as known not to be relevant are not important enough
370
## if self.skip_count:
371
## a += ', %d skip' % self.skip_count
372
## if self.known_failure_count:
373
## a += '+%dX' % self.known_failure_count
417
a = '[%d' % self.count
374
418
if self.num_tests is not None:
375
419
a +='/%d' % self.num_tests
377
runtime = time.time() - self._overall_start_time
379
a += '%dm%ds' % (runtime / 60, runtime % 60)
420
a += ' in %ds' % (time.time() - self._overall_start_time)
382
421
if self.error_count:
383
a += ', %d err' % self.error_count
422
a += ', %d errors' % self.error_count
384
423
if self.failure_count:
385
a += ', %d fail' % self.failure_count
424
a += ', %d failed' % self.failure_count
425
if self.known_failure_count:
426
a += ', %d known failures' % self.known_failure_count
428
a += ', %d skipped' % self.skip_count
386
429
if self.unsupported:
387
a += ', %d missing' % len(self.unsupported)
430
a += ', %d missing features' % len(self.unsupported)
765
796
unittest.TestCase.setUp(self)
766
797
self._cleanEnvironment()
798
bzrlib.trace.disable_default_logging()
767
799
self._silenceUI()
768
800
self._startLogFile()
769
801
self._benchcalls = []
770
802
self._benchtime = None
771
803
self._clear_hooks()
772
804
self._clear_debug_flags()
773
TestCase._active_threads = threading.activeCount()
774
self.addCleanup(self._check_leaked_threads)
776
def _check_leaked_threads(self):
777
active = threading.activeCount()
778
leaked_threads = active - TestCase._active_threads
779
TestCase._active_threads = active
781
TestCase._leaking_threads_tests += 1
782
if TestCase._first_thread_leaker_id is None:
783
TestCase._first_thread_leaker_id = self.id()
784
# we're not specifically told when all tests are finished.
785
# This will do. We use a function to avoid keeping a reference
786
# to a TestCase object.
787
atexit.register(_report_leaked_threads)
789
806
def _clear_debug_flags(self):
790
807
"""Prevent externally set debug flags affecting tests.
1029
1040
self.fail('Unexpected success. Should have failed: %s' % reason)
1031
def assertFileEqual(self, content, path):
1032
"""Fail if path does not contain 'content'."""
1033
self.failUnlessExists(path)
1034
f = file(path, 'rb')
1039
self.assertEqualDiff(content, s)
1041
def failUnlessExists(self, path):
1042
"""Fail unless path or paths, which may be abs or relative, exist."""
1043
if not isinstance(path, basestring):
1045
self.failUnlessExists(p)
1047
self.failUnless(osutils.lexists(path),path+" does not exist")
1049
def failIfExists(self, path):
1050
"""Fail if path or paths, which may be abs or relative, exist."""
1051
if not isinstance(path, basestring):
1053
self.failIfExists(p)
1055
self.failIf(osutils.lexists(path),path+" exists")
1057
1042
def _capture_deprecation_warnings(self, a_callable, *args, **kwargs):
1058
1043
"""A helper for callDeprecated and applyDeprecated.
2048
2015
self.log("actually: %r" % contents)
2049
2016
self.fail("contents of %s not as expected" % filename)
2051
def _getTestDirPrefix(self):
2052
# create a directory within the top level test directory
2053
if sys.platform == 'win32':
2054
name_prefix = re.sub('[<>*=+",:;_/\\-]', '_', self.id())
2055
# windows is likely to have path-length limits so use a short name
2056
name_prefix = name_prefix[-30:]
2058
name_prefix = re.sub('[/]', '_', self.id())
2061
2018
def makeAndChdirToTestDir(self):
2062
2019
"""See TestCaseWithMemoryTransport.makeAndChdirToTestDir().
2064
2021
For TestCaseInTempDir we create a temporary directory based on the test
2065
2022
name and then create two subdirs - test and home under it.
2067
name_prefix = osutils.pathjoin(self.TEST_ROOT, self._getTestDirPrefix())
2069
for i in range(100):
2070
if os.path.exists(name):
2071
name = name_prefix + '_' + str(i)
2024
# create a directory within the top level test directory
2025
candidate_dir = osutils.mkdtemp(dir=self.TEST_ROOT)
2075
2026
# now create test and home directories within this dir
2076
self.test_base_dir = name
2027
self.test_base_dir = candidate_dir
2077
2028
self.test_home_dir = self.test_base_dir + '/home'
2078
2029
os.mkdir(self.test_home_dir)
2079
2030
self.test_dir = self.test_base_dir + '/work'
2133
2084
def build_tree_contents(self, shape):
2134
2085
build_tree_contents(shape)
2087
def assertFileEqual(self, content, path):
2088
"""Fail if path does not contain 'content'."""
2089
self.failUnlessExists(path)
2090
f = file(path, 'rb')
2095
self.assertEqualDiff(content, s)
2097
def failUnlessExists(self, path):
2098
"""Fail unless path or paths, which may be abs or relative, exist."""
2099
if not isinstance(path, basestring):
2101
self.failUnlessExists(p)
2103
self.failUnless(osutils.lexists(path),path+" does not exist")
2105
def failIfExists(self, path):
2106
"""Fail if path or paths, which may be abs or relative, exist."""
2107
if not isinstance(path, basestring):
2109
self.failIfExists(p)
2111
self.failIf(osutils.lexists(path),path+" exists")
2136
2113
def assertInWorkingTree(self, path, root_path='.', tree=None):
2137
2114
"""Assert whether path or paths are in the WorkingTree"""
2138
2115
if tree is None:
2139
2116
tree = workingtree.WorkingTree.open(root_path)
2140
2117
if not isinstance(path, basestring):
2142
self.assertInWorkingTree(p, tree=tree)
2119
self.assertInWorkingTree(p,tree=tree)
2144
2121
self.assertIsNot(tree.path2id(path), None,
2145
2122
path+' not in working tree.')
2346
2293
return TestUtil.TestSuite(result)
2349
def filter_suite_by_re(suite, pattern):
2296
def filter_suite_by_re(suite, pattern, exclude_pattern=DEPRECATED_PARAMETER,
2297
random_order=DEPRECATED_PARAMETER):
2350
2298
"""Create a test suite by filtering another one.
2352
2300
:param suite: the source suite
2353
2301
:param pattern: pattern that names must match
2302
:param exclude_pattern: A pattern that names must not match. This parameter
2303
is deprecated as of bzrlib 1.0. Please use the separate function
2304
exclude_tests_by_re instead.
2305
:param random_order: If True, tests in the new suite will be put in
2306
random order. This parameter is deprecated as of bzrlib 1.0. Please
2307
use the separate function randomize_suite instead.
2354
2308
:returns: the newly created suite
2310
if deprecated_passed(exclude_pattern):
2311
symbol_versioning.warn(
2312
one_zero % "passing exclude_pattern to filter_suite_by_re",
2313
DeprecationWarning, stacklevel=2)
2314
if exclude_pattern is not None:
2315
suite = exclude_tests_by_re(suite, exclude_pattern)
2356
2316
condition = condition_id_re(pattern)
2357
2317
result_suite = filter_suite_by_condition(suite, condition)
2361
def filter_suite_by_id_list(suite, test_id_list):
2362
"""Create a test suite by filtering another one.
2364
:param suite: The source suite.
2365
:param test_id_list: A list of the test ids to keep as strings.
2366
:returns: the newly created suite
2368
condition = condition_id_in_list(test_id_list)
2369
result_suite = filter_suite_by_condition(suite, condition)
2373
def filter_suite_by_id_startswith(suite, start):
2374
"""Create a test suite by filtering another one.
2376
:param suite: The source suite.
2377
:param start: A string the test id must start with.
2378
:returns: the newly created suite
2380
condition = condition_id_startswith(start)
2381
result_suite = filter_suite_by_condition(suite, condition)
2318
if deprecated_passed(random_order):
2319
symbol_versioning.warn(
2320
one_zero % "passing random_order to filter_suite_by_re",
2321
DeprecationWarning, stacklevel=2)
2323
result_suite = randomize_suite(result_suite)
2382
2324
return result_suite
2416
2358
return TestUtil.TestSuite(tests)
2419
def split_suite_by_condition(suite, condition):
2420
"""Split a test suite into two by a condition.
2361
@deprecated_function(one_zero)
2362
def sort_suite_by_re(suite, pattern, exclude_pattern=None,
2363
random_order=False, append_rest=True):
2364
"""DEPRECATED: Create a test suite by sorting another one.
2366
This method has been decomposed into separate helper methods that should be
2368
- filter_suite_by_re
2369
- exclude_tests_by_re
2422
:param suite: The suite to split.
2423
:param condition: The condition to match on. Tests that match this
2424
condition are returned in the first test suite, ones that do not match
2425
are in the second suite.
2426
:return: A tuple of two test suites, where the first contains tests from
2427
suite matching the condition, and the second contains the remainder
2428
from suite. The order within each output suite is the same as it was in
2373
:param suite: the source suite
2374
:param pattern: pattern that names must match in order to go
2375
first in the new suite
2376
:param exclude_pattern: pattern that names must not match, if any
2377
:param random_order: if True, tests in the new suite will be put in
2378
random order (with all tests matching pattern
2380
:param append_rest: if False, pattern is a strict filter and not
2381
just an ordering directive
2382
:returns: the newly created suite
2433
for test in iter_suite_tests(suite):
2435
matched.append(test)
2437
did_not_match.append(test)
2438
return TestUtil.TestSuite(matched), TestUtil.TestSuite(did_not_match)
2384
if exclude_pattern is not None:
2385
suite = exclude_tests_by_re(suite, exclude_pattern)
2387
order_changer = randomize_suite
2389
order_changer = preserve_input
2391
suites = map(order_changer, split_suite_by_re(suite, pattern))
2392
return TestUtil.TestSuite(suites)
2394
return order_changer(filter_suite_by_re(suite, pattern))
2441
2397
def split_suite_by_re(suite, pattern):
2504
2471
suite = order_changer(filter_suite_by_re(suite, pattern))
2473
# Activate code coverage.
2474
if coverage_dir is not None:
2475
tracer = trace.Trace(count=1, trace=0)
2476
sys.settrace(tracer.globaltrace)
2506
2478
result = runner.run(suite)
2480
if coverage_dir is not None:
2482
results = tracer.results()
2483
results.write_results(show_missing=1, summary=False,
2484
coverdir=coverage_dir)
2509
2487
return result.wasStrictlySuccessful()
2511
2489
return result.wasSuccessful()
2514
# Controlled by "bzr selftest -E=..." option
2515
selftest_debug_flags = set()
2518
2492
def selftest(verbose=False, pattern=".*", stop_on_failure=True,
2519
2493
transport=None,
2520
2494
test_suite_factory=None,
2563
2527
list_only=list_only,
2564
2528
random_seed=random_seed,
2565
2529
exclude_pattern=exclude_pattern,
2531
coverage_dir=coverage_dir)
2568
2533
default_transport = old_transport
2569
selftest_debug_flags = old_debug_flags
2572
def load_test_id_list(file_name):
2573
"""Load a test id list from a text file.
2575
The format is one test id by line. No special care is taken to impose
2576
strict rules, these test ids are used to filter the test suite so a test id
2577
that do not match an existing test will do no harm. This allows user to add
2578
comments, leave blank lines, etc.
2582
ftest = open(file_name, 'rt')
2584
if e.errno != errno.ENOENT:
2587
raise errors.NoSuchFile(file_name)
2589
for test_name in ftest.readlines():
2590
test_list.append(test_name.strip())
2595
def suite_matches_id_list(test_suite, id_list):
2596
"""Warns about tests not appearing or appearing more than once.
2598
:param test_suite: A TestSuite object.
2599
:param test_id_list: The list of test ids that should be found in
2602
:return: (absents, duplicates) absents is a list containing the test found
2603
in id_list but not in test_suite, duplicates is a list containing the
2604
test found multiple times in test_suite.
2606
When using a prefined test id list, it may occurs that some tests do not
2607
exist anymore or that some tests use the same id. This function warns the
2608
tester about potential problems in his workflow (test lists are volatile)
2609
or in the test suite itself (using the same id for several tests does not
2610
help to localize defects).
2612
# Build a dict counting id occurrences
2614
for test in iter_suite_tests(test_suite):
2616
tests[id] = tests.get(id, 0) + 1
2621
occurs = tests.get(id, 0)
2623
not_found.append(id)
2625
duplicates.append(id)
2627
return not_found, duplicates
2630
class TestIdList(object):
2631
"""Test id list to filter a test suite.
2633
Relying on the assumption that test ids are built as:
2634
<module>[.<class>.<method>][(<param>+)], <module> being in python dotted
2635
notation, this class offers methods to :
2636
- avoid building a test suite for modules not refered to in the test list,
2637
- keep only the tests listed from the module test suite.
2640
def __init__(self, test_id_list):
2641
# When a test suite needs to be filtered against us we compare test ids
2642
# for equality, so a simple dict offers a quick and simple solution.
2643
self.tests = dict().fromkeys(test_id_list, True)
2645
# While unittest.TestCase have ids like:
2646
# <module>.<class>.<method>[(<param+)],
2647
# doctest.DocTestCase can have ids like:
2650
# <module>.<function>
2651
# <module>.<class>.<method>
2653
# Since we can't predict a test class from its name only, we settle on
2654
# a simple constraint: a test id always begins with its module name.
2657
for test_id in test_id_list:
2658
parts = test_id.split('.')
2659
mod_name = parts.pop(0)
2660
modules[mod_name] = True
2662
mod_name += '.' + part
2663
modules[mod_name] = True
2664
self.modules = modules
2666
def refers_to(self, module_name):
2667
"""Is there tests for the module or one of its sub modules."""
2668
return self.modules.has_key(module_name)
2670
def includes(self, test_id):
2671
return self.tests.has_key(test_id)
2674
def test_suite(keep_only=None, starting_with=None):
2675
2537
"""Build and return TestSuite for the whole of bzrlib.
2677
:param keep_only: A list of test ids limiting the suite returned.
2679
:param starting_with: An id limiting the suite returned to the tests
2682
2539
This function can be replaced if you need to change the default test
2683
2540
suite on a global basis, but it is not encouraged.
2685
2542
testmod_names = [
2687
2543
'bzrlib.util.tests.test_bencode',
2688
'bzrlib.tests.blackbox',
2689
'bzrlib.tests.branch_implementations',
2690
'bzrlib.tests.bzrdir_implementations',
2691
'bzrlib.tests.commands',
2692
'bzrlib.tests.inventory_implementations',
2693
'bzrlib.tests.interrepository_implementations',
2694
'bzrlib.tests.intertree_implementations',
2695
'bzrlib.tests.per_lock',
2696
'bzrlib.tests.repository_implementations',
2697
2544
'bzrlib.tests.test__dirstate_helpers',
2698
2545
'bzrlib.tests.test_ancestry',
2699
2546
'bzrlib.tests.test_annotate',
2703
2550
'bzrlib.tests.test_bisect_multi',
2704
2551
'bzrlib.tests.test_branch',
2705
2552
'bzrlib.tests.test_branchbuilder',
2706
'bzrlib.tests.test_btree_index',
2707
2553
'bzrlib.tests.test_bugtracker',
2708
2554
'bzrlib.tests.test_bundle',
2709
2555
'bzrlib.tests.test_bzrdir',
2710
2556
'bzrlib.tests.test_cache_utf8',
2711
'bzrlib.tests.test_chunk_writer',
2712
2557
'bzrlib.tests.test_commands',
2713
2558
'bzrlib.tests.test_commit',
2714
2559
'bzrlib.tests.test_commit_merge',
2760
2604
'bzrlib.tests.test_missing',
2761
2605
'bzrlib.tests.test_msgeditor',
2762
2606
'bzrlib.tests.test_multiparent',
2763
'bzrlib.tests.test_mutabletree',
2764
2607
'bzrlib.tests.test_nonascii',
2765
2608
'bzrlib.tests.test_options',
2766
2609
'bzrlib.tests.test_osutils',
2767
2610
'bzrlib.tests.test_osutils_encodings',
2768
2611
'bzrlib.tests.test_pack',
2769
'bzrlib.tests.test_pack_repository',
2770
2612
'bzrlib.tests.test_patch',
2771
2613
'bzrlib.tests.test_patches',
2772
2614
'bzrlib.tests.test_permissions',
2773
2615
'bzrlib.tests.test_plugins',
2774
2616
'bzrlib.tests.test_progress',
2775
'bzrlib.tests.test_read_bundle',
2776
2617
'bzrlib.tests.test_reconfigure',
2777
2618
'bzrlib.tests.test_reconcile',
2778
2619
'bzrlib.tests.test_registry',
2779
2620
'bzrlib.tests.test_remote',
2780
2621
'bzrlib.tests.test_repository',
2781
'bzrlib.tests.per_repository_reference',
2782
2622
'bzrlib.tests.test_revert',
2783
2623
'bzrlib.tests.test_revision',
2784
'bzrlib.tests.test_revisionspec',
2624
'bzrlib.tests.test_revisionnamespaces',
2785
2625
'bzrlib.tests.test_revisiontree',
2786
2626
'bzrlib.tests.test_rio',
2787
'bzrlib.tests.test_rules',
2788
2627
'bzrlib.tests.test_sampler',
2789
2628
'bzrlib.tests.test_selftest',
2790
2629
'bzrlib.tests.test_setup',
2810
2649
'bzrlib.tests.test_transactions',
2811
2650
'bzrlib.tests.test_transform',
2812
2651
'bzrlib.tests.test_transport',
2813
'bzrlib.tests.test_transport_implementations',
2814
2652
'bzrlib.tests.test_tree',
2815
2653
'bzrlib.tests.test_treebuilder',
2816
2654
'bzrlib.tests.test_tsort',
2817
2655
'bzrlib.tests.test_tuned_gzip',
2818
2656
'bzrlib.tests.test_ui',
2819
'bzrlib.tests.test_uncommit',
2820
2657
'bzrlib.tests.test_upgrade',
2821
'bzrlib.tests.test_upgrade_stacked',
2822
2658
'bzrlib.tests.test_urlutils',
2823
2659
'bzrlib.tests.test_versionedfile',
2824
2660
'bzrlib.tests.test_version',
2825
2661
'bzrlib.tests.test_version_info',
2826
'bzrlib.tests.test__walkdirs_win32',
2827
2662
'bzrlib.tests.test_weave',
2828
2663
'bzrlib.tests.test_whitebox',
2829
2664
'bzrlib.tests.test_win32utils',
2831
2666
'bzrlib.tests.test_workingtree_4',
2832
2667
'bzrlib.tests.test_wsgi',
2833
2668
'bzrlib.tests.test_xml',
2834
'bzrlib.tests.tree_implementations',
2835
'bzrlib.tests.workingtree_implementations',
2670
test_transport_implementations = [
2671
'bzrlib.tests.test_transport_implementations',
2672
'bzrlib.tests.test_read_bundle',
2674
suite = TestUtil.TestSuite()
2838
2675
loader = TestUtil.TestLoader()
2840
if starting_with is not None:
2841
# We take precedence over keep_only because *at loading time* using
2842
# both options means we will load less tests for the same final result.
2843
def interesting_module(name):
2845
# Either the module name starts with the specified string
2846
name.startswith(starting_with)
2847
# or it may contain tests starting with the specified string
2848
or starting_with.startswith(name)
2850
loader = TestUtil.FilteredByModuleTestLoader(interesting_module)
2852
elif keep_only is not None:
2853
id_filter = TestIdList(keep_only)
2854
loader = TestUtil.FilteredByModuleTestLoader(id_filter.refers_to)
2855
def interesting_module(name):
2856
return id_filter.refers_to(name)
2859
loader = TestUtil.TestLoader()
2860
def interesting_module(name):
2861
# No filtering, all modules are interesting
2864
suite = loader.suiteClass()
2866
# modules building their suite with loadTestsFromModuleNames
2867
2676
suite.addTest(loader.loadTestsFromModuleNames(testmod_names))
2869
modules_to_doctest = [
2874
'bzrlib.iterablefile',
2879
'bzrlib.symbol_versioning',
2882
'bzrlib.version_info_formats.format_custom',
2885
for mod in modules_to_doctest:
2886
if not interesting_module(mod):
2887
# No tests to keep here, move along
2677
from bzrlib.tests.test_transport_implementations import TransportTestProviderAdapter
2678
adapter = TransportTestProviderAdapter()
2679
adapt_modules(test_transport_implementations, adapter, loader, suite)
2680
for package in packages_to_test():
2681
suite.addTest(package.test_suite())
2682
for m in MODULES_TO_TEST:
2683
suite.addTest(loader.loadTestsFromModule(m))
2684
for m in MODULES_TO_DOCTEST:
2890
doc_suite = doctest.DocTestSuite(mod)
2686
suite.addTest(doctest.DocTestSuite(m))
2891
2687
except ValueError, e:
2892
print '**failed to get doctest for: %s\n%s' % (mod, e)
2688
print '**failed to get doctest for: %s\n%s' %(m,e)
2894
suite.addTest(doc_suite)
2896
2690
default_encoding = sys.getdefaultencoding()
2897
2691
for name, plugin in bzrlib.plugin.plugins().items():
2898
if not interesting_module(plugin.module.__name__):
2900
plugin_suite = plugin.test_suite()
2901
# We used to catch ImportError here and turn it into just a warning,
2902
# but really if you don't have --no-plugins this should be a failure.
2903
# mbp 20080213 - see http://bugs.launchpad.net/bugs/189771
2904
if plugin_suite is None:
2905
plugin_suite = plugin.load_plugin_tests(loader)
2906
if plugin_suite is not None:
2907
suite.addTest(plugin_suite)
2693
plugin_suite = plugin.test_suite()
2694
except ImportError, e:
2695
bzrlib.trace.warning(
2696
'Unable to test plugin "%s": %s', name, e)
2698
if plugin_suite is not None:
2699
suite.addTest(plugin_suite)
2908
2700
if default_encoding != sys.getdefaultencoding():
2909
2701
bzrlib.trace.warning(
2910
2702
'Plugin "%s" tried to reset default encoding to: %s', name,
2911
2703
sys.getdefaultencoding())
2913
2705
sys.setdefaultencoding(default_encoding)
2915
if starting_with is not None:
2916
suite = filter_suite_by_id_startswith(suite, starting_with)
2918
if keep_only is not None:
2919
# Now that the referred modules have loaded their tests, keep only the
2921
suite = filter_suite_by_id_list(suite, id_filter)
2922
# Do some sanity checks on the id_list filtering
2923
not_found, duplicates = suite_matches_id_list(suite, keep_only)
2924
if starting_with is not None:
2925
# The tester has used both keep_only and starting_with, so he is
2926
# already aware that some tests are excluded from the list, there
2927
# is no need to tell him which.
2930
# Some tests mentioned in the list are not in the test suite. The
2931
# list may be out of date, report to the tester.
2932
for id in not_found:
2933
bzrlib.trace.warning('"%s" not found in the test suite', id)
2934
for id in duplicates:
2935
bzrlib.trace.warning('"%s" is used as an id by several tests', id)
2940
def multiply_tests_from_modules(module_name_list, scenario_iter, loader=None):
2709
def multiply_tests_from_modules(module_name_list, scenario_iter):
2941
2710
"""Adapt all tests in some given modules to given scenarios.
2943
2712
This is the recommended public interface for test parameterization.
3003
2765
def adapt_modules(mods_list, adapter, loader, suite):
3004
2766
"""Adapt the modules in mods_list using adapter and add to suite."""
3005
tests = loader.loadTestsFromModuleNames(mods_list)
3006
adapt_tests(tests, adapter, suite)
3009
def adapt_tests(tests_list, adapter, suite):
2767
for test in iter_suite_tests(loader.loadTestsFromModuleNames(mods_list)):
2768
suite.addTests(adapter.adapt(test))
2771
def adapt_tests(tests_list, adapter, loader, suite):
3010
2772
"""Adapt the tests in tests_list using adapter and add to suite."""
3011
for test in iter_suite_tests(tests_list):
3012
suite.addTests(adapter.adapt(test))
2773
for test in tests_list:
2774
suite.addTests(adapter.adapt(loader.loadTestsFromName(test)))
3015
2777
def _rmtree_temp_dir(dirname):
3202
2929
FTPServerFeature = _FTPServerFeature()
3205
class _UnicodeFilename(Feature):
3206
"""Does the filesystem support Unicode filenames?"""
3211
except UnicodeEncodeError:
3213
except (IOError, OSError):
3214
# The filesystem allows the Unicode filename but the file doesn't
3218
# The filesystem allows the Unicode filename and the file exists,
3222
UnicodeFilename = _UnicodeFilename()
3225
class _UTF8Filesystem(Feature):
3226
"""Is the filesystem UTF-8?"""
3229
if osutils._fs_enc.upper() in ('UTF-8', 'UTF8'):
3233
UTF8Filesystem = _UTF8Filesystem()
3236
2932
class _CaseInsensitiveFilesystemFeature(Feature):
3237
2933
"""Check if underlined filesystem is case-insensitive
3238
2934
(e.g. on Windows, Cygwin, MacOS)