/breezy/unstable

To get this branch, use:
bzr branch https://code.breezy-vcs.org/breezy/unstable

« back to all changes in this revision

Viewing changes to breezy/tests/test__dirstate_helpers.py

  • Committer: Jelmer Vernooij
  • Date: 2017-05-24 01:39:33 UTC
  • mfrom: (3815.3776.6)
  • Revision ID: jelmer@jelmer.uk-20170524013933-ir4y4tqtrsiz2ka2
New upstream snapshot.

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
import os
21
21
import time
22
22
 
23
 
from bzrlib import (
 
23
from .. import (
24
24
    dirstate,
25
25
    errors,
26
26
    osutils,
27
27
    tests,
28
28
    _dirstate_helpers_py,
29
29
    )
30
 
from bzrlib.tests import (
 
30
from . import (
31
31
    test_dirstate,
32
32
    )
33
 
from bzrlib.tests.test_osutils import dir_reader_scenarios
34
 
from bzrlib.tests.scenarios import (
 
33
from .test_osutils import dir_reader_scenarios
 
34
from .scenarios import (
35
35
    load_tests_apply_scenarios,
36
36
    multiply_scenarios,
37
37
    )
38
 
from bzrlib.tests import (
 
38
from . import (
39
39
    features,
40
40
    )
41
41
 
44
44
 
45
45
 
46
46
compiled_dirstate_helpers_feature = features.ModuleAvailableFeature(
47
 
    'bzrlib._dirstate_helpers_pyx')
 
47
    'breezy._dirstate_helpers_pyx')
48
48
 
49
49
 
50
50
# FIXME: we should also parametrize against SHA1Provider !
226
226
    """Run all Bisect Path tests against _bisect_path_left."""
227
227
 
228
228
    def get_bisect_path(self):
229
 
        from bzrlib._dirstate_helpers_py import _bisect_path_left
 
229
        from breezy._dirstate_helpers_py import _bisect_path_left
230
230
        return _bisect_path_left
231
231
 
232
232
    def get_bisect(self):
239
239
    _test_needs_features = [compiled_dirstate_helpers_feature]
240
240
 
241
241
    def get_bisect_path(self):
242
 
        from bzrlib._dirstate_helpers_pyx import _bisect_path_left
 
242
        from breezy._dirstate_helpers_pyx import _bisect_path_left
243
243
        return _bisect_path_left
244
244
 
245
245
 
247
247
    """Run all Bisect Path tests against _bisect_path_right"""
248
248
 
249
249
    def get_bisect_path(self):
250
 
        from bzrlib._dirstate_helpers_py import _bisect_path_right
 
250
        from breezy._dirstate_helpers_py import _bisect_path_right
251
251
        return _bisect_path_right
252
252
 
253
253
    def get_bisect(self):
260
260
    _test_needs_features = [compiled_dirstate_helpers_feature]
261
261
 
262
262
    def get_bisect_path(self):
263
 
        from bzrlib._dirstate_helpers_pyx import _bisect_path_right
 
263
        from breezy._dirstate_helpers_pyx import _bisect_path_right
264
264
        return _bisect_path_right
265
265
 
266
266
 
278
278
 
279
279
    def get_bisect_dirblock(self):
280
280
        """Return an implementation of bisect_dirblock"""
281
 
        from bzrlib._dirstate_helpers_py import bisect_dirblock
 
281
        from breezy._dirstate_helpers_py import bisect_dirblock
282
282
        return bisect_dirblock
283
283
 
284
284
    def assertBisect(self, dirblocks, split_dirblocks, path, *args, **kwargs):
372
372
    _test_needs_features = [compiled_dirstate_helpers_feature]
373
373
 
374
374
    def get_bisect_dirblock(self):
375
 
        from bzrlib._dirstate_helpers_pyx import bisect_dirblock
 
375
        from breezy._dirstate_helpers_pyx import bisect_dirblock
376
376
        return bisect_dirblock
377
377
 
378
378
 
388
388
 
389
389
    def get_cmp_by_dirs(self):
390
390
        """Get a specific implementation of cmp_by_dirs."""
391
 
        from bzrlib._dirstate_helpers_py import cmp_by_dirs
 
391
        from breezy._dirstate_helpers_py import cmp_by_dirs
392
392
        return cmp_by_dirs
393
393
 
394
394
    def assertCmpByDirs(self, expected, str1, str2):
494
494
    _test_needs_features = [compiled_dirstate_helpers_feature]
495
495
 
496
496
    def get_cmp_by_dirs(self):
497
 
        from bzrlib._dirstate_helpers_pyx import cmp_by_dirs
 
497
        from breezy._dirstate_helpers_pyx import cmp_by_dirs
498
498
        return cmp_by_dirs
499
499
 
500
500
 
510
510
 
511
511
    def get_cmp_path_by_dirblock(self):
512
512
        """Get a specific implementation of _cmp_path_by_dirblock."""
513
 
        from bzrlib._dirstate_helpers_py import _cmp_path_by_dirblock
 
513
        from breezy._dirstate_helpers_py import _cmp_path_by_dirblock
514
514
        return _cmp_path_by_dirblock
515
515
 
516
516
    def assertCmpPathByDirblock(self, paths):
645
645
    _test_needs_features = [compiled_dirstate_helpers_feature]
646
646
 
647
647
    def get_cmp_by_dirs(self):
648
 
        from bzrlib._dirstate_helpers_pyx import _cmp_path_by_dirblock
 
648
        from breezy._dirstate_helpers_pyx import _cmp_path_by_dirblock
649
649
        return _cmp_path_by_dirblock
650
650
 
651
651
 
655
655
    _test_needs_features = [compiled_dirstate_helpers_feature]
656
656
 
657
657
    def assertMemRChr(self, expected, s, c):
658
 
        from bzrlib._dirstate_helpers_pyx import _py_memrchr
 
658
        from breezy._dirstate_helpers_pyx import _py_memrchr
659
659
        self.assertEqual(expected, _py_memrchr(s, c))
660
660
 
661
661
    def test_missing(self):
705
705
    # inherits scenarios from test_dirstate
706
706
 
707
707
    def get_read_dirblocks(self):
708
 
        from bzrlib._dirstate_helpers_py import _read_dirblocks
 
708
        from breezy._dirstate_helpers_py import _read_dirblocks
709
709
        return _read_dirblocks
710
710
 
711
711
    def test_smoketest(self):
745
745
    _test_needs_features = [compiled_dirstate_helpers_feature]
746
746
 
747
747
    def get_read_dirblocks(self):
748
 
        from bzrlib._dirstate_helpers_pyx import _read_dirblocks
 
748
        from breezy._dirstate_helpers_pyx import _read_dirblocks
749
749
        return _read_dirblocks
750
750
 
751
751
 
759
759
 
760
760
    def test_bisect_dirblock(self):
761
761
        if compiled_dirstate_helpers_feature.available():
762
 
            from bzrlib._dirstate_helpers_pyx import bisect_dirblock
 
762
            from breezy._dirstate_helpers_pyx import bisect_dirblock
763
763
        else:
764
 
            from bzrlib._dirstate_helpers_py import bisect_dirblock
 
764
            from breezy._dirstate_helpers_py import bisect_dirblock
765
765
        self.assertIs(bisect_dirblock, dirstate.bisect_dirblock)
766
766
 
767
767
    def test__bisect_path_left(self):
768
768
        if compiled_dirstate_helpers_feature.available():
769
 
            from bzrlib._dirstate_helpers_pyx import _bisect_path_left
 
769
            from breezy._dirstate_helpers_pyx import _bisect_path_left
770
770
        else:
771
 
            from bzrlib._dirstate_helpers_py import _bisect_path_left
 
771
            from breezy._dirstate_helpers_py import _bisect_path_left
772
772
        self.assertIs(_bisect_path_left, dirstate._bisect_path_left)
773
773
 
774
774
    def test__bisect_path_right(self):
775
775
        if compiled_dirstate_helpers_feature.available():
776
 
            from bzrlib._dirstate_helpers_pyx import _bisect_path_right
 
776
            from breezy._dirstate_helpers_pyx import _bisect_path_right
777
777
        else:
778
 
            from bzrlib._dirstate_helpers_py import _bisect_path_right
 
778
            from breezy._dirstate_helpers_py import _bisect_path_right
779
779
        self.assertIs(_bisect_path_right, dirstate._bisect_path_right)
780
780
 
781
781
    def test_cmp_by_dirs(self):
782
782
        if compiled_dirstate_helpers_feature.available():
783
 
            from bzrlib._dirstate_helpers_pyx import cmp_by_dirs
 
783
            from breezy._dirstate_helpers_pyx import cmp_by_dirs
784
784
        else:
785
 
            from bzrlib._dirstate_helpers_py import cmp_by_dirs
 
785
            from breezy._dirstate_helpers_py import cmp_by_dirs
786
786
        self.assertIs(cmp_by_dirs, dirstate.cmp_by_dirs)
787
787
 
788
788
    def test__read_dirblocks(self):
789
789
        if compiled_dirstate_helpers_feature.available():
790
 
            from bzrlib._dirstate_helpers_pyx import _read_dirblocks
 
790
            from breezy._dirstate_helpers_pyx import _read_dirblocks
791
791
        else:
792
 
            from bzrlib._dirstate_helpers_py import _read_dirblocks
 
792
            from breezy._dirstate_helpers_py import _read_dirblocks
793
793
        self.assertIs(_read_dirblocks, dirstate._read_dirblocks)
794
794
 
795
795
    def test_update_entry(self):
796
796
        if compiled_dirstate_helpers_feature.available():
797
 
            from bzrlib._dirstate_helpers_pyx import update_entry
 
797
            from breezy._dirstate_helpers_pyx import update_entry
798
798
        else:
799
 
            from bzrlib.dirstate import update_entry
 
799
            from breezy.dirstate import update_entry
800
800
        self.assertIs(update_entry, dirstate.update_entry)
801
801
 
802
802
    def test_process_entry(self):
803
803
        if compiled_dirstate_helpers_feature.available():
804
 
            from bzrlib._dirstate_helpers_pyx import ProcessEntryC
 
804
            from breezy._dirstate_helpers_pyx import ProcessEntryC
805
805
            self.assertIs(ProcessEntryC, dirstate._process_entry)
806
806
        else:
807
 
            from bzrlib.dirstate import ProcessEntryPython
 
807
            from breezy.dirstate import ProcessEntryPython
808
808
            self.assertIs(ProcessEntryPython, dirstate._process_entry)
809
809
 
810
810