/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: Alexander Belchenko
  • Date: 2007-12-03 17:03:10 UTC
  • mfrom: (3066 +trunk)
  • mto: This revision was merged to the branch mainline in revision 3067.
  • Revision ID: bialix@ukr.net-20071203170310-yd93m6cv1al4t8nl
merge bzr.dev; NEWS entry.

Show diffs side-by-side

added added

removed removed

Lines of Context:
94
94
                          TestSuite,
95
95
                          TestLoader,
96
96
                          )
 
97
from bzrlib.tests.EncodingAdapter import EncodingTestAdapter
97
98
from bzrlib.tests.treeshape import build_tree_contents
98
99
from bzrlib.workingtree import WorkingTree, WorkingTreeFormat2
99
100
 
2045
2046
 
2046
2047
        This doesn't add anything to a branch.
2047
2048
 
 
2049
        :type shape:    list or tuple.
2048
2050
        :param line_endings: Either 'binary' or 'native'
2049
2051
            in binary mode, exact contents are written in native mode, the
2050
2052
            line endings match the default platform endings.
2052
2054
            If the transport is readonly or None, "." is opened automatically.
2053
2055
        :return: None
2054
2056
        """
 
2057
        if type(shape) not in (list, tuple):
 
2058
            raise AssertionError("Parameter 'shape' should be "
 
2059
                "a list or a tuple. Got %r instead" % (shape,))
2055
2060
        # It's OK to just create them using forward slashes on windows.
2056
2061
        if transport is None or transport.is_readonly():
2057
2062
            transport = get_transport(".")
2473
2478
                   'bzrlib.tests.test_store',
2474
2479
                   'bzrlib.tests.test_strace',
2475
2480
                   'bzrlib.tests.test_subsume',
 
2481
                   'bzrlib.tests.test_switch',
2476
2482
                   'bzrlib.tests.test_symbol_versioning',
2477
2483
                   'bzrlib.tests.test_tag',
2478
2484
                   'bzrlib.tests.test_testament',
2511
2517
    from bzrlib.tests.test_transport_implementations import TransportTestProviderAdapter
2512
2518
    adapter = TransportTestProviderAdapter()
2513
2519
    adapt_modules(test_transport_implementations, adapter, loader, suite)
 
2520
    adapt_tests(
 
2521
        ["bzrlib.tests.test_msgeditor.MsgEditorTest."
 
2522
         "test__create_temp_file_with_commit_template_in_unicode_dir"],
 
2523
        EncodingTestAdapter(), loader, suite)
2514
2524
    for package in packages_to_test():
2515
2525
        suite.addTest(package.test_suite())
2516
2526
    for m in MODULES_TO_TEST:
2602
2612
        suite.addTests(adapter.adapt(test))
2603
2613
 
2604
2614
 
 
2615
def adapt_tests(tests_list, adapter, loader, suite):
 
2616
    """Adapt the tests in tests_list using adapter and add to suite."""
 
2617
    for test in tests_list:
 
2618
        suite.addTests(adapter.adapt(loader.loadTestsFromName(test)))
 
2619
 
 
2620
 
2605
2621
def _rmtree_temp_dir(dirname):
2606
2622
    # If LANG=C we probably have created some bogus paths
2607
2623
    # which rmtree(unicode) will fail to delete
2755
2771
        return 'FTPServer'
2756
2772
 
2757
2773
FTPServerFeature = _FTPServerFeature()
 
2774
 
 
2775
 
 
2776
class _CaseInsensitiveFilesystemFeature(Feature):
 
2777
    """Check if underlined filesystem is case-insensitive
 
2778
    (e.g. on Windows, Cygwin, MacOS)
 
2779
    """
 
2780
 
 
2781
    def _probe(self):
 
2782
        if TestCaseWithMemoryTransport.TEST_ROOT is None:
 
2783
            root = osutils.mkdtemp(prefix='testbzr-', suffix='.tmp')
 
2784
            TestCaseWithMemoryTransport.TEST_ROOT = root
 
2785
        else:
 
2786
            root = TestCaseWithMemoryTransport.TEST_ROOT
 
2787
        tdir = osutils.mkdtemp(prefix='case-sensitive-probe-', suffix='',
 
2788
            dir=root)
 
2789
        name_a = osutils.pathjoin(tdir, 'a')
 
2790
        name_A = osutils.pathjoin(tdir, 'A')
 
2791
        os.mkdir(name_a)
 
2792
        result = osutils.isdir(name_A)
 
2793
        _rmtree_temp_dir(tdir)
 
2794
        return result
 
2795
 
 
2796
    def feature_name(self):
 
2797
        return 'case-insensitive filesystem'
 
2798
 
 
2799
CaseInsensitiveFilesystemFeature = _CaseInsensitiveFilesystemFeature()