/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/test_knit.py

  • Committer: John Arbash Meinel
  • Date: 2009-07-31 17:42:29 UTC
  • mto: This revision was merged to the branch mainline in revision 4611.
  • Revision ID: john@arbash-meinel.com-20090731174229-w2zdsdlfpeddk8gl
Now we got to the per-workingtree tests, etc.

The main causes seem to break down into:
  bzrdir.clone() is known to be broken wrt locking, this effects
  everything that tries to 'push'

  shelf code is not compatible with strict locking

  merge code seems to have an issue. This might actually be the
  root cause of the clone() problems.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006-2010 Canonical Ltd
 
1
# Copyright (C) 2005, 2006, 2007 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
28
28
    multiparent,
29
29
    osutils,
30
30
    pack,
31
 
    tests,
32
31
    )
33
32
from bzrlib.errors import (
34
33
    RevisionAlreadyPresent,
70
69
    )
71
70
 
72
71
 
73
 
compiled_knit_feature = tests.ModuleAvailableFeature(
74
 
                            'bzrlib._knit_load_data_pyx')
 
72
class _CompiledKnitFeature(Feature):
 
73
 
 
74
    def _probe(self):
 
75
        try:
 
76
            import bzrlib._knit_load_data_pyx
 
77
        except ImportError:
 
78
            return False
 
79
        return True
 
80
 
 
81
    def feature_name(self):
 
82
        return 'bzrlib._knit_load_data_pyx'
 
83
 
 
84
CompiledKnitFeature = _CompiledKnitFeature()
75
85
 
76
86
 
77
87
class KnitContentTestsMixin(object):
356
366
        :return: (versioned_file, reload_counter)
357
367
            versioned_file  a KnitVersionedFiles using the packs for access
358
368
        """
359
 
        builder = self.make_branch_builder('.', format="1.9")
 
369
        builder = self.make_branch_builder('.')
360
370
        builder.start_series()
361
371
        builder.build_snapshot('rev-1', None, [
362
372
            ('add', ('', 'root-id', 'directory', None)),
862
872
 
863
873
    def get_knit_index(self, transport, name, mode):
864
874
        mapper = ConstantMapper(name)
 
875
        orig = knit._load_data
 
876
        def reset():
 
877
            knit._load_data = orig
 
878
        self.addCleanup(reset)
865
879
        from bzrlib._knit_load_data_py import _load_data_py
866
 
        self.overrideAttr(knit, '_load_data', _load_data_py)
 
880
        knit._load_data = _load_data_py
867
881
        allow_writes = lambda: 'w' in mode
868
882
        return _KndxIndex(transport, mapper, lambda:None, allow_writes, lambda:True)
869
883
 
1294
1308
 
1295
1309
class LowLevelKnitIndexTests_c(LowLevelKnitIndexTests):
1296
1310
 
1297
 
    _test_needs_features = [compiled_knit_feature]
 
1311
    _test_needs_features = [CompiledKnitFeature]
1298
1312
 
1299
1313
    def get_knit_index(self, transport, name, mode):
1300
1314
        mapper = ConstantMapper(name)
 
1315
        orig = knit._load_data
 
1316
        def reset():
 
1317
            knit._load_data = orig
 
1318
        self.addCleanup(reset)
1301
1319
        from bzrlib._knit_load_data_pyx import _load_data_c
1302
 
        self.overrideAttr(knit, '_load_data', _load_data_c)
 
1320
        knit._load_data = _load_data_c
1303
1321
        allow_writes = lambda: mode == 'w'
1304
 
        return _KndxIndex(transport, mapper, lambda:None,
1305
 
                          allow_writes, lambda:True)
 
1322
        return _KndxIndex(transport, mapper, lambda:None, allow_writes, lambda:True)
1306
1323
 
1307
1324
 
1308
1325
class Test_KnitAnnotator(TestCaseWithMemoryTransport):