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

  • Committer: Marius Kruger
  • Date: 2007-01-18 04:11:51 UTC
  • mfrom: (2240 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2241.
  • Revision ID: amanic@gmail.com-20070118041151-m5kjsutaymhy8yoy
merge bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
1668
1668
    return result
1669
1669
 
1670
1670
 
 
1671
def sort_suite_by_re(suite, pattern):
 
1672
    first = []
 
1673
    second = []
 
1674
    filter_re = re.compile(pattern)
 
1675
    for test in iter_suite_tests(suite):
 
1676
        if filter_re.search(test.id()):
 
1677
            first.append(test)
 
1678
        else:
 
1679
            second.append(test)
 
1680
    return TestUtil.TestSuite(first + second)
 
1681
 
 
1682
 
1671
1683
def run_suite(suite, name='test', verbose=False, pattern=".*",
1672
1684
              stop_on_failure=False, keep_output=False,
1673
 
              transport=None, lsprof_timed=None, bench_history=None):
 
1685
              transport=None, lsprof_timed=None, bench_history=None,
 
1686
              matching_tests_first=None):
1674
1687
    TestCase._gather_lsprof_in_benchmarks = lsprof_timed
1675
1688
    if verbose:
1676
1689
        verbosity = 2
1683
1696
                            bench_history=bench_history)
1684
1697
    runner.stop_on_failure=stop_on_failure
1685
1698
    if pattern != '.*':
1686
 
        suite = filter_suite_by_re(suite, pattern)
 
1699
        if matching_tests_first:
 
1700
            suite = sort_suite_by_re(suite, pattern)
 
1701
        else:
 
1702
            suite = filter_suite_by_re(suite, pattern)
1687
1703
    result = runner.run(suite)
1688
1704
    return result.wasSuccessful()
1689
1705
 
1693
1709
             transport=None,
1694
1710
             test_suite_factory=None,
1695
1711
             lsprof_timed=None,
1696
 
             bench_history=None):
 
1712
             bench_history=None,
 
1713
             matching_tests_first=None):
1697
1714
    """Run the whole test suite under the enhanced runner"""
1698
1715
    # XXX: Very ugly way to do this...
1699
1716
    # Disable warning about old formats because we don't want it to disturb
1715
1732
                     stop_on_failure=stop_on_failure, keep_output=keep_output,
1716
1733
                     transport=transport,
1717
1734
                     lsprof_timed=lsprof_timed,
1718
 
                     bench_history=bench_history)
 
1735
                     bench_history=bench_history,
 
1736
                     matching_tests_first=matching_tests_first)
1719
1737
    finally:
1720
1738
        default_transport = old_transport
1721
1739