~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_lock.py

  • Committer: Andrew Bennetts
  • Date: 2009-11-25 07:27:43 UTC
  • mto: This revision was merged to the branch mainline in revision 4825.
  • Revision ID: andrew.bennetts@canonical.com-20091125072743-v6sv4m2mkt9iyslp
Terminate SSHSubprocesses when no refs to them are left, in case .close is never called.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2009, 2011 Canonical Ltd
 
1
# Copyright (C) 2009 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
 
20
21
from bzrlib import (
21
22
    debug,
22
23
    errors,
23
24
    lock,
24
25
    tests,
25
26
    )
26
 
from bzrlib.tests.scenarios import load_tests_apply_scenarios
27
 
 
28
 
 
29
 
load_tests = load_tests_apply_scenarios
 
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
30
38
 
31
39
 
32
40
class TestOSLock(tests.TestCaseInTempDir):
33
41
 
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
 
 
 
42
    # Set by load_tests
40
43
    read_lock = None
41
44
    write_lock = None
42
45