Status: | Merged |
---|---|
Approved by: | Jelmer Vernooij |
Approved revision: | 4048 |
Merged at revision: | 4109 |
Proposed branch: | lp:~bzr/bzr-svn/stacks |
Merge into: | lp:bzr-svn/1.1 |
Diff against target: |
267 lines (+152/-8) 5 files modified
__init__.py (+4/-2) branch.py (+4/-0) config.py (+46/-5) tests/__init__.py (+5/-1) tests/test_config.py (+93/-0) |
To merge this branch: | bzr merge lp:~bzr/bzr-svn/stacks |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Jelmer Vernooij (community) | Approve | ||
Review via email: mp+78259@code.launchpad.net |
Commit message
Description of the change
This should be enough to make bzr-svn compatible with the config stacks.
As discussed, I didn't try to make it compatible with previous versions of
bzr, as such I'm proposing this for discussion (and used
lp:~bzr/bzr-svn/stacks so we can both push there).
One important thing to keep in mind too: using the previous design is still
supported so the options can still be accessed via both APIs. What matters
is whether bzr-svn is using specific options (use whatever fit the need) or
options also used by bzr (in which case as options are migrated they will
start relying on get_config_stack() being implemented as shown here).
Overall, except from the minor nits I bothered you with on IRC (thanks for
the explantions ;) this was pretty straight forward:
- a specific store,
- a section matcher,
- a stack
For the later, I almost had an heart attack when you mentioned that the
modifications are always done in locations.conf... until I realized the
stack can perfectly support that: a mutable store and a mutable section name
is all that is required, nobody ever said it should always be branch.conf
for a branch ;)
Jelmer Vernooij (jelmer) wrote : | # |
Jelmer Vernooij (jelmer) wrote : | # |
This indeed looks a lot saner than what bzr-svn was doing previously, and is hopefully also less prone to breakage.
23 +# Inject our config stuff to be tested against the bzr test suite
24 +_mod_bzr_
25 + 'subversion', "bzrlib.
26 +_mod_bzr_
27 + 'subversion', "bzrlib.
This seems a bit unnecessary to me. I'd much rather just define a SvnBranchStackTests class in bzrlib.
- 4044. By Vincent Ladeuil
-
Subclass matcher tests instead of duplicating them.
- 4045. By Vincent Ladeuil
-
Subclass store tests instead of using the registry.
- 4046. By Vincent Ladeuil
-
Remove the duplication. It doesn't exist in the bzrlib tests, it shouldn't exist here either.
- 4047. By Vincent Ladeuil
-
Subclass stack tests instead of using the registry.
- 4048. By Vincent Ladeuil
-
Remove cruft.
Vincent Ladeuil (vila) wrote : | # |
> This indeed looks a lot saner than what bzr-svn was doing previously, and is
> hopefully also less prone to breakage.
>
> 23 +# Inject our config stuff to be tested against the bzr test suite
> 24 +_mod_bzr_
> 25 + 'subversion', "bzrlib.
> "build_
> 26 +_mod_bzr_
> 27 + 'subversion', "bzrlib.
> "build_
>
> This seems a bit unnecessary to me. I'd much rather just define a
> SvnBranchStackTests class in bzrlib.
> from some base StackTests test class in bzrlib.
I tried that. This allowed me to fix the bzrlib tests a bit (I'll submit
that later, some tweaks and 2 bogus tests there).
So the try was worth it but I'm not fully convinced by the result.
Unfortunately the intermediate diff is not crystal clear as I removed some
duplication from my first submission.
In summary, the 2 registrations are replaced by 10 test classes each with
their own setUp() to replace the parametrization. As mentioned on IRC, this
open the door to divergence if more classes are added.
This means the tests are now part of -s bp.svn but all the debug still
happen in the base class, not super sexy to use.
Robert Collins (lifeless) wrote : | # |
FWIW parameterisation is a lot nicer than subclassing most of the time.
Jelmer Vernooij (jelmer) wrote : | # |
> > This indeed looks a lot saner than what bzr-svn was doing previously, and is
> > hopefully also less prone to breakage.
> >
> > 23 +# Inject our config stuff to be tested against the bzr test suite
> > 24 +_mod_bzr_
> > 25 + 'subversion', "bzrlib.
> > "build_
> > 26 +_mod_bzr_
> > 27 + 'subversion', "bzrlib.
> > "build_
> >
> > This seems a bit unnecessary to me. I'd much rather just define a
> > SvnBranchStackTests class in bzrlib.
> derives
> > from some base StackTests test class in bzrlib.
>
> I tried that. This allowed me to fix the bzrlib tests a bit (I'll submit
> that later, some tweaks and 2 bogus tests there).
>
> So the try was worth it but I'm not fully convinced by the result.
>
> Unfortunately the intermediate diff is not crystal clear as I removed some
> duplication from my first submission.
>
> In summary, the 2 registrations are replaced by 10 test classes each with
> their own setUp() to replace the parametrization. As mentioned on IRC, this
> open the door to divergence if more classes are added.
Yeah, I agree it's also far from ideal, but I like it better than having to register test helpers in a plugins' __init__.
> This means the tests are now part of -s bp.svn but all the debug still
> happen in the base class, not super sexy to use.
I think to do this right, we need to fix bzrlib.
multiply_
This method could then be called inside bzrlib.
Vincent Ladeuil (vila) wrote : | # |
> FWIW parameterisation is a lot nicer than subclassing most of the time.
I think so too, thanks for chiming in ;)
Vincent Ladeuil (vila) wrote : | # |
>> In summary, the 2 registrations are replaced by 10 test classes each with
>> their own setUp() to replace the parametrization. As mentioned on IRC, this
>> open the door to divergence if more classes are added.
> Yeah, I agree it's also far from ideal, but I like it better than
> having to register test helpers in a plugins' __init__.
Reminder: the registration have to be done there before either of
bp.svn.
is loaded by this lazy registration though, so it shouldn't have any
impact on startup times (which is the point of lazy loading).
What exactly do you dislike with registration here ? I'm not trying to
make you take the "blue pill", registration is not meant to be
mandatory. In fact, it defines a very narrow API that should be easy to
implement. I'm not trying to *reduce* the flexibility for plugin authors
(quite the contrary), I'm just trying to make it easy to reuse the
tests.
I'm Ok with investigating alternate ways to get there though.
>> This means the tests are now part of -s bp.svn but all the debug
>> still happen in the base class, not super sexy to use.
> I think to do this right, we need to fix
> bzrlib.
> multiply method? E.g.
That's what parametrization is about. I don't understand the kind of fix
you're talking about here ?
> multiply_
more like:
multiply_
multiply_
multiply_
which still scales worse than parametrization, while still requiring
implementing the same helpers.
It seems to reduce the flexibility for all parties involved, I'm fine
with plugins not reusing the bzrlib tests but it seems we're
bike-shedding about how they can reuse them.
There are already 2 ways to reuse these tests:
- lazy registration, the simplest, required to be used in __init__ to be
taken into account in all cases (-s and all that jazz) and be seen as
additional parametrization of bt.test_config. No performance impact
should occur here even if the tests are not run.
- subclassing which allow specific additional tests to be run or base
tests to be skipped or whatever the plugin want to test.
The former guarantees that the plugin conforms to the required API. The
second allows the plugin to diverge from this API or extend it if
needed. Both can or should be used by the plugins depending on what they
implement.
subclassing also requires a more intimate knowledge of what the base
tests are about.
> This method could then be called inside
> bzrlib.
> It would remove the need to do test helper registration in
> bp.svn.__init___.
This introduces an additional constraint on bt.test_config. What are the
benefits there ?
ISTM we are walking on the path that led to poolie's introduction of:
load_tests = scenarios.
Using a registry targeted at tests is the same logic IMHO: the test
class defines an API (the parameters) and we need a way to add som...
Jelmer Vernooij (jelmer) wrote : | # |
> FWIW parameterisation is a lot nicer than subclassing most of the time.
Sure, I don't disagree with that. I think the parametrization isn't done right here.
Vincent Ladeuil (vila) wrote : | # |
> Sure, I don't disagree with that. I think the parametrization isn't done
right here.
Not telling me in what way it's not done right, doesn't help me much ;)
One issue I can think of is about how these tests are named, because it has
an impact on how -s will work with them:
- if they are named as bt.test_config, -s bt.test_config includes them
(while respecting BZR_PLUGIN_PATH and friends)
- if they are named as bp.svn, -s bp.svn includes them but -s bt.test_config
doesn't anymore
In fact, they cannot be part of -s bt.test_config without some help from
svn/__init__.py otherwise even the load_tests() there is ignored so no
tests/ file has a way to add them.
There may be a trick to duplicate the tests under both hierarchies but same
care should be taken if both are selected.
The parametrization is about deciding which tests should be run with which
scenario.
The store scenario is:
('subversion', {'get_store': store_builder, 'store_id': 'subversion'})
The stack scenario is:
('subversion', {'get_store': store_builder, 'get_stack': stack_builder})
The matcher scenario (not sure we really want scenarios for matchers, but if
we want):
('subversion', {'get_store': store_builder,
From that which test classes should be used is decided either in bzr or in
bzr-svn.
Deciding from bzr allows to define the required interface.
Deciding from bzr-svn allows to define which interface you agree to
implement.
Asking for more control about the test classes requires knowledege about
them.
I don't know where you stand on that.
You certainly have a great deal of experience with plugins needing to respect
an interface, parametrized or not.
My two proposals for that seems to be at the two extremes, do you have a
preferred sweet spot between them ?
I've started defining:
def multiply_
scenarios = [('subversion', {'get_store': store_builder,
return tests.multiply_
def multiply_
scenarios = [('subversion', {'get_store': store_builder,
return tests.multiply_
def multiply_
scenarios = [('subversion', {'get_store': store_builder,
return tests.multiply_
in bzr-svn but that still need to know:
- which test classes should be used,
- and derived from that, how the tests should be named.
There are infinite ways to proceed and I don't think iterating them all is
the best use of our time ;) Can we agree on something and make it evolve as
we encounter the issues and better understand the problem ?
Vincent Ladeuil (vila) wrote : | # |
pingeling
Jelmer Vernooij (jelmer) wrote : | # |
Sorry for taking so long to get back to you on this. I've given it some more thought.. perhaps we can unblock this.
> > Sure, I don't disagree with that. I think the parametrization isn't done
> right here.
> Not telling me in what way it's not done right, doesn't help me much ;)
Test stuff should be as much as possible isolated to the test side of the code - and not be executed as part of normal operations. I still think this is not a good use of registries, but having this sort of registration in the load_tests code of bzr-svn would be a lot nicer than where it is now.
> One issue I can think of is about how these tests are named, because it has
> an impact on how -s will work with them:
>
> - if they are named as bt.test_config, -s bt.test_config includes them
> (while respecting BZR_PLUGIN_PATH and friends)
>
> - if they are named as bp.svn, -s bp.svn includes them but -s bt.test_config
> doesn't anymore
>
> In fact, they cannot be part of -s bt.test_config without some help from
> svn/__init__.py otherwise even the load_tests() there is ignored so no
> tests/ file has a way to add them.
This is already the case for a lot of other things, so I don't think it would be a problem if -s bt.test_config didn't execute them. For example, compare "bzr selftest -s bt.per_interbranch" and "bzr selftest bzrlib.
"make check" in bzr-svn simply runs "bzr selftest Svn svn Subversion" and that works fine and includes all relevant tests.
> The parametrization is about deciding which tests should be run with which
> scenario.
> [...]
> Asking for more control about the test classes requires knowledege about
> them.
>
> I don't know where you stand on that.
>
> You certainly have a great deal of experience with plugins needing to respect
> an interface, parametrized or not.
>
> My two proposals for that seems to be at the two extremes, do you have a
> preferred sweet spot between them ?
Having to know the test classes in bzr-svn is fine with me; there is always going to be some churn in the interfaces bzr-svn is involved in, and that's easy enough to keep up with.
> I've started defining:
>
> def multiply_
> scenarios = [('subversion', {'get_store': store_builder,
> 'store_id': 'subversion'})]
> return tests.multiply_
>
>
> def multiply_
> scenarios = [('subversion', {'get_store': store_builder,
> 'store_id': 'subversion',
> 'matcher': matcher_class})]
> return tests.multiply_
>
>
> def multiply_
> scenarios = [('subversion', {'get_store': store_builder,
> 'get_stack': stack_builder})]
> return tests.multiply_
>
> in bzr-svn but that still need to know:
Wouldn't it be possible to do it the other way around? Making bzrlib.
Vincent Ladeuil (vila) wrote : | # |
<snip/>
> Test stuff should be as much as possible isolated to the test side
> of the code - and not be executed as part of normal operations.
Right. I did my best to reduce the test related code invasion to a
minimum but I agree this still has a bad smell. I thought this minimum
was small enough to be ignored but I understand you can disagree ;)
> I still think this is not a good use of registries,
That's the part I don't get, so, let's forget this proposal for a
second. Can you point where their usage causes problems in
bzrlib/test_config ?
I ended up introducing them because it made it easier for me to add new
stores, stacks and so on, and get them tested instantly for the existing
features so I could focus on the newly introduced ones only.
> but having this sort of registration in the load_tests code of
> bzr-svn would be a lot nicer than where it is now.
Then, with the caveat I mentioned below (and you seem to be ok with),
that seems do be the best way to go (see my comments below on
alternatives).
That will just mean moving the registrations in load_tests in which case
*calling* load_tests is the only thing that needs to happen to have the
svn-specific tests run.
>> One issue I can think of is about how these tests are named, because it has
>> an impact on how -s will work with them:
>>
>> - if they are named as bt.test_config, -s bt.test_config includes them
>> (while respecting BZR_PLUGIN_PATH and friends)
>>
>> - if they are named as bp.svn, -s bp.svn includes them but -s bt.test_config
>> doesn't anymore
>>
>> In fact, they cannot be part of -s bt.test_config without some help from
>> svn/__init__.py otherwise even the load_tests() there is ignored so no
>> tests/ file has a way to add them.
> This is already the case for a lot of other things, so I don't
> think it would be a problem if -s bt.test_config didn't execute
> them.
Well, for the bzrlib/config.py maintainer, having the plugin tests
executed while fixing bugs or adding features is way simpler than to
have to execute all the plugin tests (even restricted to the config
related ones).
> For example, compare "bzr selftest -s bt.per_interbranch" and "bzr
> selftest bzrlib.
> all plugins, the former does not.
Yup, that's what I wanted to address. If the plugin is enabled, so are
the tests.
We still seem to talk past each other. May be it's a difference
between bzrlib/config and plugins points of view ?
Is there some plugin specific issue I fail to understand here ?
Compatibility related may be ?
> "make check" in bzr-svn simply runs "bzr selftest Svn svn
> Subversion" and that works fine and includes all relevant tests.
That's your call and I respect that.
>> The parametrization is about deciding which tests should be run with which
>> scenario.
>> [...]
>> Asking for more control about the test classes requires knowledege about
>> them.
>>
>> I don't know where you stand on that.
>>
>> You certainly have a great deal of experience with plugins needing to respect
>> a...
Jelmer Vernooij (jelmer) wrote : | # |
> > I still think this is not a good use of registries,
> That's the part I don't get, so, let's forget this proposal for a
> second. Can you point where their usage causes problems in
> bzrlib/test_config ?
Registries are basically lazy dictionaries. One of their key points is that it is possible to retrieve a single item by key without loading any of the rest of the registry. The way they're being used here is more as a way of delayed lists. The key is basically ignored.
The current tests also require a fair amount of setup - and that's currently done with a function that gets passed the TestCase class. This then makes life hard for bzr-svn setup, because bzr-svn has its own setup code. With e.g. a mixin this wouldn't be as problematic.
Code like:
if getattr(test, 'backing_branch', None) is None:
is too magical imho.
> I ended up introducing them because it made it easier for me to add new
> stores, stacks and so on, and get them tested instantly for the existing
> features so I could focus on the newly introduced ones only.
>
> > but having this sort of registration in the load_tests code of
> > bzr-svn would be a lot nicer than where it is now.
>
> Then, with the caveat I mentioned below (and you seem to be ok with),
> that seems do be the best way to go (see my comments below on
> alternatives).
>
> That will just mean moving the registrations in load_tests in which case
> *calling* load_tests is the only thing that needs to happen to have the
> svn-specific tests run.
I'm still not thrilled about that, but I could live with it.
The current branch is also reasonable enough for me, so I'm happy to land that.
> >> One issue I can think of is about how these tests are named, because it
> has
> >> an impact on how -s will work with them:
> >>
> >> - if they are named as bt.test_config, -s bt.test_config includes them
> >> (while respecting BZR_PLUGIN_PATH and friends)
> >>
> >> - if they are named as bp.svn, -s bp.svn includes them but -s
> bt.test_config
> >> doesn't anymore
> >>
> >> In fact, they cannot be part of -s bt.test_config without some help
> from
> >> svn/__init__.py otherwise even the load_tests() there is ignored so no
> >> tests/ file has a way to add them.
>
> > This is already the case for a lot of other things, so I don't
> > think it would be a problem if -s bt.test_config didn't execute
> > them.
>
> Well, for the bzrlib/config.py maintainer, having the plugin tests
> executed while fixing bugs or adding features is way simpler than to
> have to execute all the plugin tests (even restricted to the config
> related ones).
I don't really think the bzrlib/config.py maintainer should worry about that - the main point is that the API stays stable, plugin authors should worry about sticking to that API (and the tests can help with that). Sure, we should discuss design implications of the config.py design, but I don't think you should have to worry about bzr-svn test failures.
> > For example, compare "bzr selftest -s bt.per_interbranch" and "bzr
> > selftest bzrlib.
> > all plugins, ...
Jelmer Vernooij (jelmer) : | # |
Preview Diff
1 | === modified file '__init__.py' |
2 | --- __init__.py 2011-10-04 22:39:59 +0000 |
3 | +++ __init__.py 2011-10-05 21:11:25 +0000 |
4 | @@ -53,7 +53,8 @@ |
5 | translation = load_plugin_translations("bzr-svn") |
6 | gettext = translation.gettext |
7 | |
8 | -from bzrlib import config |
9 | + |
10 | +from bzrlib import config as _mod_bzr_config # Or we mask plugins.svn.config |
11 | from bzrlib.branch import ( |
12 | network_format_registry as branch_network_format_registry, |
13 | ) |
14 | @@ -394,10 +395,11 @@ |
15 | revspec_registry.register_lazy("svn:", "bzrlib.plugins.svn.revspec", |
16 | "RevisionSpec_svn") |
17 | |
18 | -config.credential_store_registry.register_lazy( |
19 | +_mod_bzr_config.credential_store_registry.register_lazy( |
20 | "subversion", "bzrlib.plugins.svn.auth", "SubversionCredentialStore", |
21 | help=__doc__, fallback=True) |
22 | |
23 | + |
24 | foreign_vcs_registry.register_lazy("svn", "bzrlib.plugins.svn.mapping", |
25 | "foreign_vcs_svn") |
26 | |
27 | |
28 | === modified file 'branch.py' |
29 | --- branch.py 2011-09-29 08:47:11 +0000 |
30 | +++ branch.py 2011-10-05 21:11:25 +0000 |
31 | @@ -80,6 +80,7 @@ |
32 | ) |
33 | from bzrlib.plugins.svn.config import ( |
34 | BranchConfig, |
35 | + SvnBranchStack, |
36 | ) |
37 | from bzrlib.plugins.svn.errors import ( |
38 | NotSvnBranchPath, |
39 | @@ -453,6 +454,9 @@ |
40 | def get_config(self): |
41 | return BranchConfig(self.base, self.repository.uuid) |
42 | |
43 | + def get_config_stack(self): |
44 | + return SvnBranchStack(self) |
45 | + |
46 | def get_append_revisions_only(self): |
47 | return self.get_config().get_append_revisions_only() |
48 | |
49 | |
50 | === modified file 'config.py' |
51 | --- config.py 2011-09-23 12:10:59 +0000 |
52 | +++ config.py 2011-10-05 21:11:25 +0000 |
53 | @@ -23,11 +23,12 @@ |
54 | properties, |
55 | ) |
56 | |
57 | -import bzrlib.config |
58 | from bzrlib import ( |
59 | atomicfile, |
60 | + config as _mod_bzr_config, |
61 | osutils, |
62 | trace, |
63 | + transport, |
64 | ) |
65 | from bzrlib.config import ( |
66 | ConfigObj, |
67 | @@ -44,8 +45,6 @@ |
68 | BzrError, |
69 | ) |
70 | |
71 | -from bzrlib.config import LockableConfig |
72 | - |
73 | |
74 | def as_bool(str): |
75 | """Parse a string as a boolean. |
76 | @@ -71,8 +70,50 @@ |
77 | # was seen at. |
78 | |
79 | |
80 | - |
81 | -class SubversionUUIDConfig(LockableConfig): |
82 | +class SubversionStore(_mod_bzr_config.LockableIniFileStore): |
83 | + |
84 | + def __init__(self, possible_transports=None): |
85 | + t = transport.get_transport_from_path( |
86 | + _mod_bzr_config.config_dir(), |
87 | + possible_transports=possible_transports) |
88 | + super(SubversionStore, self).__init__(t, 'subversion.conf') |
89 | + |
90 | + |
91 | +class UUIDMatcher(_mod_bzr_config.SectionMatcher): |
92 | + """UUID-based Subversion section matcher.""" |
93 | + |
94 | + def __init__(self, store, uuid): |
95 | + super(UUIDMatcher, self).__init__(store) |
96 | + self.uuid = uuid |
97 | + |
98 | + def match(self, section): |
99 | + return section.id == self.uuid |
100 | + |
101 | + |
102 | +class SvnBranchStack(_mod_bzr_config._CompatibleStack): |
103 | + """SvnBranch stack providing UUID specific options.""" |
104 | + |
105 | + def __init__(self, branch): |
106 | + bstore = _mod_bzr_config.BranchStore(branch) |
107 | + lstore = _mod_bzr_config.LocationStore() |
108 | + loc_matcher = _mod_bzr_config.LocationMatcher(lstore, branch.base) |
109 | + svn_store = SubversionStore() |
110 | + uuid_matcher = UUIDMatcher(svn_store, |
111 | + getattr(branch.repository, 'uuid', None)) |
112 | + gstore = _mod_bzr_config.GlobalStore() |
113 | + super(SvnBranchStack, self).__init__( |
114 | + [self._get_overrides, |
115 | + loc_matcher.get_sections, |
116 | + bstore.get_sections, |
117 | + uuid_matcher.get_sections, |
118 | + gstore.get_sections], |
119 | + # All modifications go to the corresponding section in |
120 | + # locations.conf |
121 | + lstore, branch.base) |
122 | + self.branch = branch |
123 | + |
124 | + |
125 | +class SubversionUUIDConfig(_mod_bzr_config.LockableConfig): |
126 | """UUID-based Subversion configuration.""" |
127 | |
128 | def __init__(self, uuid): |
129 | |
130 | === modified file 'tests/__init__.py' |
131 | --- tests/__init__.py 2011-09-06 21:21:36 +0000 |
132 | +++ tests/__init__.py 2011-10-05 21:11:25 +0000 |
133 | @@ -16,7 +16,10 @@ |
134 | |
135 | """Tests for the bzr-svn plugin.""" |
136 | |
137 | -from subvertpy import NODE_UNKNOWN |
138 | +from subvertpy import ( |
139 | + NODE_UNKNOWN, |
140 | + repos, |
141 | + ) |
142 | import subvertpy.tests |
143 | |
144 | from bzrlib import osutils |
145 | @@ -29,6 +32,7 @@ |
146 | from bzrlib.workingtree import WorkingTree |
147 | |
148 | from bzrlib.plugins.svn import ( |
149 | + config, |
150 | transport as _mod_svn_transport, |
151 | ) |
152 | |
153 | |
154 | === modified file 'tests/test_config.py' |
155 | --- tests/test_config.py 2011-09-18 22:26:33 +0000 |
156 | +++ tests/test_config.py 2011-10-05 21:11:25 +0000 |
157 | @@ -16,17 +16,110 @@ |
158 | |
159 | """Config tests.""" |
160 | |
161 | +from bzrlib import bzrdir |
162 | from bzrlib.branch import Branch |
163 | from bzrlib.repository import Repository |
164 | +from bzrlib.tests import test_config |
165 | from bzrlib.workingtree import WorkingTree |
166 | from bzrlib.plugins.svn.config import ( |
167 | NoSubversionBuildPackageConfig, |
168 | PropertyConfig, |
169 | SubversionBuildPackageConfig, |
170 | + SubversionStore, |
171 | + SvnBranchStack, |
172 | + UUIDMatcher, |
173 | ) |
174 | from bzrlib.plugins.svn.mapping3.scheme import TrunkBranchingScheme |
175 | from bzrlib.plugins.svn.tests import SubversionTestCase |
176 | |
177 | + |
178 | +def build_subversion_store(test): |
179 | + return SubversionStore() |
180 | + |
181 | +def build_svn_branch_stack(test): |
182 | + """See bt.test_config.build_backing_branch.""" |
183 | + if getattr(test, 'backing_branch', None) is None: |
184 | + # First call, let's build the branch on disk |
185 | + repo = test.make_repository('branch', format='subversion') |
186 | + test.backing_branch = bzrdir.BzrDir.open(repo.base |
187 | + ).create_branch(lossy=False) |
188 | + b = Branch.open('branch') |
189 | + return SvnBranchStack(b) |
190 | + |
191 | + |
192 | +class TestReadonlySubversionStore(test_config.TestReadonlyStore): |
193 | + |
194 | + def setUp(self): |
195 | + super(TestReadonlySubversionStore, self).setUp() |
196 | + self.get_store = build_subversion_store |
197 | + |
198 | + |
199 | +class TestMutableSubversionStore(test_config.TestMutableStore): |
200 | + |
201 | + def setUp(self): |
202 | + super(TestMutableSubversionStore, self).setUp() |
203 | + self.store_id = 'subversion' |
204 | + self.get_store = build_subversion_store |
205 | + |
206 | + |
207 | +class TestUUIDMatcherStoreLoading(test_config.TestSectionMatcher): |
208 | + |
209 | + def setUp(self): |
210 | + super(TestUUIDMatcherStoreLoading, self).setUp() |
211 | + self.get_store = build_subversion_store |
212 | + self.matcher = UUIDMatcher |
213 | + |
214 | + |
215 | +class TestUUIDMatching(test_config.TestNameMatcher): |
216 | + |
217 | + def setUp(self): |
218 | + super(TestUUIDMatching, self).setUp() |
219 | + self.get_store = build_subversion_store |
220 | + self.matcher = UUIDMatcher |
221 | + |
222 | + |
223 | +class TestConcurrentStoreUpdates(test_config.TestConcurrentStoreUpdates): |
224 | + |
225 | + def setUp(self): |
226 | + self.get_stack = build_svn_branch_stack |
227 | + super(TestConcurrentStoreUpdates, self).setUp() |
228 | + |
229 | + |
230 | +class TestConcreteStacks(test_config.TestConcreteStacks): |
231 | + |
232 | + def setUp(self): |
233 | + self.get_stack = build_svn_branch_stack |
234 | + super(TestConcreteStacks, self).setUp() |
235 | + |
236 | + |
237 | +class TestStackGet(test_config.TestStackGet): |
238 | + |
239 | + def setUp(self): |
240 | + self.get_stack = build_svn_branch_stack |
241 | + super(TestStackGet, self).setUp() |
242 | + |
243 | + |
244 | +class TestStackGetWithConverter(test_config.TestStackGetWithConverter): |
245 | + |
246 | + def setUp(self): |
247 | + self.get_stack = build_svn_branch_stack |
248 | + super(TestStackGetWithConverter, self).setUp() |
249 | + |
250 | + |
251 | +class TestStackSet(test_config.TestStackSet): |
252 | + |
253 | + def setUp(self): |
254 | + self.get_stack = build_svn_branch_stack |
255 | + super(TestStackSet, self).setUp() |
256 | + |
257 | + |
258 | +class TestStackRemove(test_config.TestStackRemove): |
259 | + |
260 | + def setUp(self): |
261 | + self.get_stack = build_svn_branch_stack |
262 | + super(TestStackRemove, self).setUp() |
263 | + |
264 | + |
265 | class ReposConfigTests(SubversionTestCase): |
266 | |
267 | def setUp(self): |
Thanks!