bzr branch
http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
|
6614.1.3
by Vincent Ladeuil
Fix assertEquals being deprecated by using assertEqual. |
1 |
# Copyright (C) 2006-2012, 2016 Canonical Ltd
|
|
1534.4.40
by Robert Collins
Add RepositoryFormats and allow bzrdir.open or create _repository to be used. |
2 |
# Authors: Robert Collins <robert.collins@canonical.com>
|
|
2241.1.1
by Martin Pool
Change RepositoryFormat to use a Registry rather than ad-hoc dictionary |
3 |
# and others
|
|
1887.1.1
by Adeodato Simó
Do not separate paragraphs in the copyright statement with blank lines, |
4 |
#
|
|
1534.4.40
by Robert Collins
Add RepositoryFormats and allow bzrdir.open or create _repository to be used. |
5 |
# This program is free software; you can redistribute it and/or modify
|
6 |
# it under the terms of the GNU General Public License as published by
|
|
7 |
# the Free Software Foundation; either version 2 of the License, or
|
|
8 |
# (at your option) any later version.
|
|
|
1887.1.1
by Adeodato Simó
Do not separate paragraphs in the copyright statement with blank lines, |
9 |
#
|
|
1534.4.40
by Robert Collins
Add RepositoryFormats and allow bzrdir.open or create _repository to be used. |
10 |
# This program is distributed in the hope that it will be useful,
|
11 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13 |
# GNU General Public License for more details.
|
|
|
1887.1.1
by Adeodato Simó
Do not separate paragraphs in the copyright statement with blank lines, |
14 |
#
|
|
1534.4.40
by Robert Collins
Add RepositoryFormats and allow bzrdir.open or create _repository to be used. |
15 |
# You should have received a copy of the GNU General Public License
|
16 |
# along with this program; if not, write to the Free Software
|
|
|
4183.7.1
by Sabin Iacob
update FSF mailing address |
17 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
1534.4.40
by Robert Collins
Add RepositoryFormats and allow bzrdir.open or create _repository to be used. |
18 |
|
19 |
||
|
1904.2.5
by Martin Pool
Fix format warning inside test suite and add test |
20 |
"""Repository implementation tests for bzr.
|
|
1534.4.40
by Robert Collins
Add RepositoryFormats and allow bzrdir.open or create _repository to be used. |
21 |
|
22 |
These test the conformance of all the repository variations to the expected API.
|
|
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
23 |
Specific tests for individual formats are in the tests/test_repository.py file
|
|
4523.1.1
by Martin Pool
Rename tests.branch_implementations to per_branch |
24 |
rather than in tests/per_branch/*.py.
|
|
1534.4.40
by Robert Collins
Add RepositoryFormats and allow bzrdir.open or create _repository to be used. |
25 |
"""
|
26 |
||
|
6622.1.34
by Jelmer Vernooij
Rename brzlib => breezy. |
27 |
from breezy import ( |
|
2241.1.2
by Martin Pool
change to using external Repository format registry |
28 |
repository, |
29 |
)
|
|
|
6670.4.14
by Jelmer Vernooij
Move remote to breezy.bzr. |
30 |
from breezy.bzr.remote import RemoteRepositoryFormat |
|
6622.1.34
by Jelmer Vernooij
Rename brzlib => breezy. |
31 |
from breezy.tests import ( |
|
5017.3.24
by Vincent Ladeuil
selftest -s bt.test_selftest passing |
32 |
default_transport, |
33 |
multiply_tests, |
|
34 |
test_server, |
|
35 |
)
|
|
|
6622.1.34
by Jelmer Vernooij
Rename brzlib => breezy. |
36 |
from breezy.tests.per_controldir.test_controldir import TestCaseWithControlDir |
37 |
from breezy.transport import memory |
|
|
1534.4.40
by Robert Collins
Add RepositoryFormats and allow bzrdir.open or create _repository to be used. |
38 |
|
39 |
||
|
3221.10.1
by Robert Collins
Add add_inventory external reference interface tests and tweak broken test support function adapt_tests. |
40 |
def formats_to_scenarios(formats, transport_server, transport_readonly_server, |
41 |
vfs_transport_factory=None): |
|
42 |
"""Transform the input formats to a list of scenarios. |
|
|
2553.2.2
by Robert Collins
Move RepositoryTestProviderAdapter into the tests part of the code base. |
43 |
|
|
3543.1.1
by Michael Hudson
change the scenario multiplication to get the bzrdir format from the tree and |
44 |
:param formats: A list of (scenario_name_suffix, repo_format)
|
|
3543.1.3
by Martin Pool
Better docstring for formats_to_scenarios |
45 |
where the scenario_name_suffix is to be appended to the format
|
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
46 |
name, and the repo_format is a RepositoryFormat subclass
|
|
3543.1.3
by Martin Pool
Better docstring for formats_to_scenarios |
47 |
instance.
|
48 |
:returns: Scenarios of [(scenario_name, {parameter_name: value})]
|
|
|
2553.2.2
by Robert Collins
Move RepositoryTestProviderAdapter into the tests part of the code base. |
49 |
"""
|
|
3221.10.1
by Robert Collins
Add add_inventory external reference interface tests and tweak broken test support function adapt_tests. |
50 |
result = [] |
|
3543.1.1
by Michael Hudson
change the scenario multiplication to get the bzrdir format from the tree and |
51 |
for scenario_name_suffix, repository_format in formats: |
|
3453.5.3
by Andrew Bennetts
Merge make-branch-and-tree-fix. |
52 |
scenario_name = repository_format.__class__.__name__ |
53 |
scenario_name += scenario_name_suffix |
|
54 |
scenario = (scenario_name, |
|
|
3221.10.1
by Robert Collins
Add add_inventory external reference interface tests and tweak broken test support function adapt_tests. |
55 |
{"transport_server":transport_server, |
56 |
"transport_readonly_server":transport_readonly_server, |
|
|
3543.1.1
by Michael Hudson
change the scenario multiplication to get the bzrdir format from the tree and |
57 |
"bzrdir_format":repository_format._matchingbzrdir, |
|
3221.10.1
by Robert Collins
Add add_inventory external reference interface tests and tweak broken test support function adapt_tests. |
58 |
"repository_format":repository_format, |
59 |
})
|
|
60 |
# Only override the test's vfs_transport_factory if one was
|
|
61 |
# specified, otherwise just leave the default in place.
|
|
62 |
if vfs_transport_factory: |
|
63 |
scenario[1]['vfs_transport_factory'] = vfs_transport_factory |
|
64 |
result.append(scenario) |
|
65 |
return result |
|
66 |
||
67 |
||
68 |
def all_repository_format_scenarios(): |
|
|
3474.2.1
by Martin Pool
Merge and cleanup pre-external-reference-repository tests |
69 |
"""Return a list of test scenarios for parameterising repository tests. |
70 |
"""
|
|
|
5651.4.1
by Jelmer Vernooij
Add docstrings. |
71 |
all_formats = repository.format_registry._get_all() |
|
3221.10.1
by Robert Collins
Add add_inventory external reference interface tests and tweak broken test support function adapt_tests. |
72 |
# format_scenarios is all the implementations of Repository; i.e. all disk
|
73 |
# formats plus RemoteRepository.
|
|
74 |
format_scenarios = formats_to_scenarios( |
|
|
3543.1.1
by Michael Hudson
change the scenario multiplication to get the bzrdir format from the tree and |
75 |
[('', format) for format in all_formats], |
|
3825.4.3
by Andrew Bennetts
Conditionally replace LocalURLServer in the test rather than changing the default_transport behaviour of per_repository tests. |
76 |
default_transport, |
|
3221.10.1
by Robert Collins
Add add_inventory external reference interface tests and tweak broken test support function adapt_tests. |
77 |
# None here will cause a readonly decorator to be created
|
78 |
# by the TestCaseWithTransport.get_readonly_transport method.
|
|
79 |
None) |
|
80 |
format_scenarios.extend(formats_to_scenarios( |
|
|
3543.1.1
by Michael Hudson
change the scenario multiplication to get the bzrdir format from the tree and |
81 |
[('-default', RemoteRepositoryFormat())], |
|
5017.3.24
by Vincent Ladeuil
selftest -s bt.test_selftest passing |
82 |
test_server.SmartTCPServer_for_testing, |
83 |
test_server.ReadonlySmartTCPServer_for_testing, |
|
|
5017.3.45
by Vincent Ladeuil
Move MemoryServer back into bzrlib.transport.memory as it's needed as soon as a MemoryTransport is used. Add a NEWS entry. |
84 |
memory.MemoryServer)) |
|
3453.5.3
by Andrew Bennetts
Merge make-branch-and-tree-fix. |
85 |
format_scenarios.extend(formats_to_scenarios( |
|
3543.1.1
by Michael Hudson
change the scenario multiplication to get the bzrdir format from the tree and |
86 |
[('-v2', RemoteRepositoryFormat())], |
|
5017.3.24
by Vincent Ladeuil
selftest -s bt.test_selftest passing |
87 |
test_server.SmartTCPServer_for_testing_v2_only, |
88 |
test_server.ReadonlySmartTCPServer_for_testing_v2_only, |
|
|
5017.3.45
by Vincent Ladeuil
Move MemoryServer back into bzrlib.transport.memory as it's needed as soon as a MemoryTransport is used. Add a NEWS entry. |
89 |
memory.MemoryServer)) |
|
3221.10.1
by Robert Collins
Add add_inventory external reference interface tests and tweak broken test support function adapt_tests. |
90 |
return format_scenarios |
|
2553.2.2
by Robert Collins
Move RepositoryTestProviderAdapter into the tests part of the code base. |
91 |
|
92 |
||
|
5363.2.18
by Jelmer Vernooij
Rename TestCaseWithBzrDir -> TestCaseWithControlDir. |
93 |
class TestCaseWithRepository(TestCaseWithControlDir): |
|
2485.7.1
by Robert Collins
Relocate TestCaseWithRepository to be more central. |
94 |
|
|
6155.6.3
by Jelmer Vernooij
Use resolve_format. |
95 |
def get_default_format(self): |
|
6155.6.5
by Jelmer Vernooij
use matchingbzrdir. |
96 |
format = self.repository_format._matchingbzrdir |
|
6614.1.3
by Vincent Ladeuil
Fix assertEquals being deprecated by using assertEqual. |
97 |
self.assertEqual(format.repository_format, self.repository_format) |
|
6155.6.3
by Jelmer Vernooij
Use resolve_format. |
98 |
return format |
99 |
||
|
6202.2.2
by Jelmer Vernooij
Default to shared=None rather than shared=False for repositories, since some formats don't support non-shared repositories. |
100 |
def make_repository(self, relpath, shared=None, format=None): |
|
6155.6.3
by Jelmer Vernooij
Use resolve_format. |
101 |
format = self.resolve_format(format) |
102 |
repo = super(TestCaseWithRepository, self).make_repository( |
|
103 |
relpath, shared=shared, format=format) |
|
104 |
if format is None or format.repository_format is self.repository_format: |
|
|
2485.7.1
by Robert Collins
Relocate TestCaseWithRepository to be more central. |
105 |
# Create a repository of the type we are trying to test.
|
|
2553.2.2
by Robert Collins
Move RepositoryTestProviderAdapter into the tests part of the code base. |
106 |
if getattr(self, "repository_to_test_repository", None): |
|
2553.2.1
by Robert Collins
Overhaul RepositoryTestAdapter to be cleaner and more modular. |
107 |
repo = self.repository_to_test_repository(repo) |
|
6155.6.3
by Jelmer Vernooij
Use resolve_format. |
108 |
return repo |
|
2485.7.1
by Robert Collins
Relocate TestCaseWithRepository to be more central. |
109 |
|
110 |
||
|
6625.1.5
by Martin
Drop custom load_tests implementation and use unittest signature |
111 |
def load_tests(loader, standard_tests, pattern): |
|
6622.1.34
by Jelmer Vernooij
Rename brzlib => breezy. |
112 |
prefix = 'breezy.tests.per_repository.' |
|
2745.6.58
by Andrew Bennetts
Slightly neater test parameterisation in repository_implementations; extract a 'multiply_scenarios' function. |
113 |
test_repository_modules = [ |
|
3221.12.1
by Robert Collins
Backport development1 format (stackable packs) to before-shallow-branches. |
114 |
'test_add_fallback_repository', |
|
2745.6.57
by Andrew Bennetts
Some improvements suggested by Martin's review. |
115 |
'test_break_lock', |
116 |
'test_check', |
|
117 |
'test_commit_builder', |
|
118 |
'test_fetch', |
|
|
5815.5.3
by Jelmer Vernooij
Add basic test for per file graph. |
119 |
'test_file_graph', |
|
3373.5.2
by John Arbash Meinel
Add repository_implementation tests for get_parent_map |
120 |
'test_get_parent_map', |
|
2745.6.57
by Andrew Bennetts
Some improvements suggested by Martin's review. |
121 |
'test_has_same_location', |
|
3172.3.1
by Robert Collins
Repository has a new method ``has_revisions`` which signals the presence |
122 |
'test_has_revisions', |
|
5865.1.1
by Jelmer Vernooij
add tests for Repository.is_locked. |
123 |
'test_locking', |
|
2745.6.57
by Andrew Bennetts
Some improvements suggested by Martin's review. |
124 |
'test_pack', |
125 |
'test_reconcile', |
|
|
4145.1.2
by Robert Collins
Add a refresh_data method on Repository allowing cleaner handling of insertions into RemoteRepository objects with _real_repository instances. |
126 |
'test_refresh_data', |
|
2745.6.57
by Andrew Bennetts
Some improvements suggested by Martin's review. |
127 |
'test_repository', |
128 |
'test_revision', |
|
|
6205.2.1
by Jelmer Vernooij
Move signature tests to bt.per_repository. |
129 |
'test_signatures', |
|
2745.6.57
by Andrew Bennetts
Some improvements suggested by Martin's review. |
130 |
'test_statistics', |
131 |
'test_write_group', |
|
|
2745.6.54
by Andrew Bennetts
Tidy test parameterisation in repository_implementations. |
132 |
]
|
|
3689.1.1
by John Arbash Meinel
Rename repository_implementations tests into per_repository tests |
133 |
# Parameterize per_repository test modules by format.
|
|
5582.10.44
by Jelmer Vernooij
Clean up patch. |
134 |
submod_tests = loader.loadTestsFromModuleNames( |
|
4084.5.1
by Robert Collins
Bulk update all test adaptation into a single approach, using multiply_tests rather than test adapters. |
135 |
[prefix + module_name for module_name in test_repository_modules]) |
|
3221.10.1
by Robert Collins
Add add_inventory external reference interface tests and tweak broken test support function adapt_tests. |
136 |
format_scenarios = all_repository_format_scenarios() |
|
5684.3.1
by Jelmer Vernooij
move reconcile tests to per_repository_vf. |
137 |
return multiply_tests(submod_tests, format_scenarios, standard_tests) |