bzr branch
http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
|
5218.2.2
by John Arbash Meinel
Bring in the global chk change, which includes some more bzr.dev code. |
1 |
# Copyright (C) 2009, 2010 Canonical Ltd
|
|
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. |
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
|
|
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. |
16 |
|
17 |
"""Tests for Repository.refresh_data."""
|
|
18 |
||
|
6622.1.34
by Jelmer Vernooij
Rename brzlib => breezy. |
19 |
from breezy import ( |
|
5199.1.1
by Andrew Bennetts
Allow repositories to support refresh_data during a write group. |
20 |
repository, |
|
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. |
21 |
)
|
|
6622.1.34
by Jelmer Vernooij
Rename brzlib => breezy. |
22 |
from breezy.tests.per_repository import TestCaseWithRepository |
|
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. |
23 |
|
24 |
||
25 |
class TestRefreshData(TestCaseWithRepository): |
|
26 |
||
27 |
def test_refresh_data_unlocked(self): |
|
28 |
# While not interesting, it should not error.
|
|
29 |
repo = self.make_repository('.') |
|
30 |
repo.refresh_data() |
|
31 |
||
32 |
def test_refresh_data_read_locked(self): |
|
33 |
# While not interesting, it should not error.
|
|
34 |
repo = self.make_repository('.') |
|
35 |
repo.lock_read() |
|
36 |
self.addCleanup(repo.unlock) |
|
37 |
repo.refresh_data() |
|
38 |
||
39 |
def test_refresh_data_write_locked(self): |
|
40 |
# While not interesting, it should not error.
|
|
41 |
repo = self.make_repository('.') |
|
42 |
repo.lock_write() |
|
43 |
self.addCleanup(repo.unlock) |
|
44 |
repo.refresh_data() |
|
45 |
||
|
5199.1.1
by Andrew Bennetts
Allow repositories to support refresh_data during a write group. |
46 |
def test_refresh_data_in_write_group(self): |
47 |
# refresh_data may either succeed or raise IsInWriteGroupError during a
|
|
48 |
# write group.
|
|
|
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. |
49 |
repo = self.make_repository('.') |
50 |
repo.lock_write() |
|
51 |
self.addCleanup(repo.unlock) |
|
52 |
repo.start_write_group() |
|
53 |
self.addCleanup(repo.abort_write_group) |
|
|
5199.1.1
by Andrew Bennetts
Allow repositories to support refresh_data during a write group. |
54 |
try: |
55 |
repo.refresh_data() |
|
56 |
except repository.IsInWriteGroupError: |
|
57 |
# This is ok.
|
|
58 |
pass
|
|
59 |
else: |
|
60 |
# This is ok too.
|
|
61 |
pass
|