2904.1.1
by Robert Collins
* New method ``bzrlib.repository.Repository.is_write_locked`` useful for |
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
|
2904.1.1
by Robert Collins
* New method ``bzrlib.repository.Repository.is_write_locked`` useful for |
16 |
|
17 |
"""Tests for Repository.is_write_locked()."""
|
|
18 |
||
3689.1.1
by John Arbash Meinel
Rename repository_implementations tests into per_repository tests |
19 |
from bzrlib.tests.per_repository import TestCaseWithRepository |
2904.1.1
by Robert Collins
* New method ``bzrlib.repository.Repository.is_write_locked`` useful for |
20 |
|
21 |
||
22 |
class TestIsWriteLocked(TestCaseWithRepository): |
|
23 |
||
24 |
def test_not_locked(self): |
|
25 |
repo = self.make_repository('.') |
|
26 |
self.assertFalse(repo.is_write_locked()) |
|
27 |
||
28 |
def test_read_locked(self): |
|
29 |
repo = self.make_repository('.') |
|
30 |
repo.lock_read() |
|
31 |
self.addCleanup(repo.unlock) |
|
32 |
self.assertFalse(repo.is_write_locked()) |
|
33 |
||
34 |
def test_write_locked(self): |
|
35 |
repo = self.make_repository('.') |
|
36 |
repo.lock_write() |
|
37 |
self.addCleanup(repo.unlock) |
|
38 |
self.assertTrue(repo.is_write_locked()) |
|
5865.1.1
by Jelmer Vernooij
add tests for Repository.is_locked. |
39 |
|
40 |
||
41 |
class TestIsLocked(TestCaseWithRepository): |
|
42 |
||
43 |
def test_not_locked(self): |
|
44 |
repo = self.make_repository('.') |
|
45 |
self.assertFalse(repo.is_locked()) |
|
46 |
||
47 |
def test_read_locked(self): |
|
48 |
repo = self.make_repository('.') |
|
49 |
repo.lock_read() |
|
50 |
self.addCleanup(repo.unlock) |
|
51 |
self.assertTrue(repo.is_locked()) |
|
52 |
||
53 |
def test_write_locked(self): |
|
54 |
repo = self.make_repository('.') |
|
55 |
repo.lock_write() |
|
56 |
self.addCleanup(repo.unlock) |
|
57 |
self.assertTrue(repo.is_locked()) |