/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/tests/test_lock.py

  • Committer: Jelmer Vernooij
  • Date: 2019-10-28 01:38:39 UTC
  • mto: This revision was merged to the branch mainline in revision 7412.
  • Revision ID: jelmer@jelmer.uk-20191028013839-q63zzm4yr0id9b3o
Allow unknown extras in git commits when just inspecting revisions, rather than importing.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2009 Canonical Ltd
 
1
# Copyright (C) 2009, 2011 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
17
17
"""Tests for OS Locks."""
18
18
 
19
19
 
20
 
 
21
 
from bzrlib import (
 
20
from .. import (
22
21
    debug,
23
22
    errors,
24
23
    lock,
25
24
    tests,
26
25
    )
27
 
 
28
 
 
29
 
def load_tests(standard_tests, module, loader):
30
 
    """Parameterize tests for all versions of groupcompress."""
31
 
    scenarios = []
32
 
    for name, write_lock, read_lock in lock._lock_classes:
33
 
        scenarios.append((name, {'write_lock': write_lock,
34
 
                                 'read_lock': read_lock}))
35
 
    suite = loader.suiteClass()
36
 
    result = tests.multiply_tests(standard_tests, scenarios, suite)
37
 
    return result
 
26
from .scenarios import load_tests_apply_scenarios
 
27
 
 
28
 
 
29
load_tests = load_tests_apply_scenarios
38
30
 
39
31
 
40
32
class TestOSLock(tests.TestCaseInTempDir):
41
33
 
42
 
    # Set by load_tests
 
34
    scenarios = [(
 
35
        name, {
 
36
            'write_lock': write_lock,
 
37
            'read_lock': read_lock})
 
38
        for name, write_lock, read_lock in lock._lock_classes]
 
39
 
43
40
    read_lock = None
44
41
    write_lock = None
45
42
 
121
118
        finally:
122
119
            w_lock.unlock()
123
120
 
124
 
 
125
121
    def test_temporary_write_lock(self):
126
122
        r_lock = self.read_lock('a-lock-file')
127
123
        try: