1098
1095
To test that a deprecated method raises an error, do something like
1101
self.assertRaises(errors.ReservedId,
1102
self.applyDeprecated, zero_ninetyone,
1103
br.append_revision, 'current:')
1098
self.assertRaises(errors.ReservedId,
1099
self.applyDeprecated,
1100
deprecated_in((1, 5, 0)),
1105
1104
:param deprecation_format: The deprecation format that the callable
1106
1105
should have been deprecated with. This is the same type as the
1539
1538
elif isinstance(args[0], basestring):
1540
1539
args = list(shlex.split(args[0]))
1542
symbol_versioning.warn(zero_ninetyone %
1543
"passing varargs to run_bzr_subprocess",
1544
DeprecationWarning, stacklevel=3)
1541
raise ValueError("passing varargs to run_bzr_subprocess")
1545
1542
process = self.start_bzr_subprocess(args, env_changes=env_changes,
1546
1543
working_dir=working_dir,
1547
1544
allow_plugins=allow_plugins)
2317
2314
return TestUtil.TestSuite(result)
2320
def filter_suite_by_re(suite, pattern, exclude_pattern=DEPRECATED_PARAMETER,
2321
random_order=DEPRECATED_PARAMETER):
2317
def filter_suite_by_re(suite, pattern):
2322
2318
"""Create a test suite by filtering another one.
2324
2320
:param suite: the source suite
2325
2321
:param pattern: pattern that names must match
2326
:param exclude_pattern: A pattern that names must not match. This parameter
2327
is deprecated as of bzrlib 1.0. Please use the separate function
2328
exclude_tests_by_re instead.
2329
:param random_order: If True, tests in the new suite will be put in
2330
random order. This parameter is deprecated as of bzrlib 1.0. Please
2331
use the separate function randomize_suite instead.
2332
2322
:returns: the newly created suite
2334
if deprecated_passed(exclude_pattern):
2335
symbol_versioning.warn(
2336
one_zero % "passing exclude_pattern to filter_suite_by_re",
2337
DeprecationWarning, stacklevel=2)
2338
if exclude_pattern is not None:
2339
suite = exclude_tests_by_re(suite, exclude_pattern)
2340
2324
condition = condition_id_re(pattern)
2341
2325
result_suite = filter_suite_by_condition(suite, condition)
2342
if deprecated_passed(random_order):
2343
symbol_versioning.warn(
2344
one_zero % "passing random_order to filter_suite_by_re",
2345
DeprecationWarning, stacklevel=2)
2347
result_suite = randomize_suite(result_suite)
2348
2326
return result_suite
2394
2372
return TestUtil.TestSuite(tests)
2397
@deprecated_function(one_zero)
2398
def sort_suite_by_re(suite, pattern, exclude_pattern=None,
2399
random_order=False, append_rest=True):
2400
"""DEPRECATED: Create a test suite by sorting another one.
2402
This method has been decomposed into separate helper methods that should be
2404
- filter_suite_by_re
2405
- exclude_tests_by_re
2409
:param suite: the source suite
2410
:param pattern: pattern that names must match in order to go
2411
first in the new suite
2412
:param exclude_pattern: pattern that names must not match, if any
2413
:param random_order: if True, tests in the new suite will be put in
2414
random order (with all tests matching pattern
2416
:param append_rest: if False, pattern is a strict filter and not
2417
just an ordering directive
2418
:returns: the newly created suite
2420
if exclude_pattern is not None:
2421
suite = exclude_tests_by_re(suite, exclude_pattern)
2423
order_changer = randomize_suite
2425
order_changer = preserve_input
2427
suites = map(order_changer, split_suite_by_re(suite, pattern))
2428
return TestUtil.TestSuite(suites)
2430
return order_changer(filter_suite_by_re(suite, pattern))
2433
2375
def split_suite_by_re(suite, pattern):
2434
2376
"""Split a test suite into two by a regular expression.