2353.3.9
by John Arbash Meinel
Update the lock code and test code so that if more than one |
1 |
# Copyright (C) 2007 Canonical Ltd
|
2 |
#
|
|
3 |
# This program is free software; you can redistribute it and/or modify
|
|
4 |
# it under the terms of the GNU General Public License as published by
|
|
5 |
# the Free Software Foundation; either version 2 of the License, or
|
|
6 |
# (at your option) any later version.
|
|
7 |
#
|
|
8 |
# This program is distributed in the hope that it will be useful,
|
|
9 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
10 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
11 |
# GNU General Public License for more details.
|
|
12 |
#
|
|
13 |
# You should have received a copy of the GNU General Public License
|
|
14 |
# along with this program; if not, write to the Free Software
|
|
4183.7.1
by Sabin Iacob
update FSF mailing address |
15 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
2353.3.9
by John Arbash Meinel
Update the lock code and test code so that if more than one |
16 |
|
17 |
"""OS Lock implementation tests for bzr.
|
|
18 |
||
19 |
These test the conformance of all the lock variations to the expected API.
|
|
20 |
"""
|
|
21 |
||
22 |
from copy import deepcopy |
|
23 |
||
24 |
from bzrlib import ( |
|
25 |
lock, |
|
26 |
tests, |
|
27 |
)
|
|
28 |
||
29 |
||
30 |
class TestCaseWithLock(tests.TestCaseWithTransport): |
|
4084.5.1
by Robert Collins
Bulk update all test adaptation into a single approach, using multiply_tests rather than test adapters. |
31 |
pass
|
32 |
||
33 |
||
34 |
def make_scenarios(lock_classes): |
|
35 |
result = [] |
|
36 |
for name, write_lock, read_lock in lock_classes: |
|
37 |
result.append( |
|
38 |
(name, {'write_lock': write_lock, 'read_lock': read_lock})) |
|
39 |
return result |
|
40 |
||
41 |
||
42 |
||
43 |
def load_tests(standard_tests, module, loader): |
|
44 |
submod_tests = loader.loadTestsFromModuleNames([ |
|
2353.3.9
by John Arbash Meinel
Update the lock code and test code so that if more than one |
45 |
'bzrlib.tests.per_lock.test_lock', |
2353.4.3
by John Arbash Meinel
Implement a 'ReadLock.temporary_write_lock()' to upgrade to a write-lock in-process. |
46 |
'bzrlib.tests.per_lock.test_temporary_write_lock', |
4084.5.1
by Robert Collins
Bulk update all test adaptation into a single approach, using multiply_tests rather than test adapters. |
47 |
])
|
48 |
scenarios = make_scenarios(lock._lock_classes) |
|
3302.9.27
by Vincent Ladeuil
Fixed as per Ian's review. |
49 |
# add the tests for the sub modules
|
4084.5.1
by Robert Collins
Bulk update all test adaptation into a single approach, using multiply_tests rather than test adapters. |
50 |
return tests.multiply_tests(submod_tests, scenarios, |
51 |
standard_tests) |