~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/codehosting/tests/helpers.py

  • Committer: Julian Edwards
  • Date: 2011-07-28 20:46:18 UTC
  • mfrom: (13553 devel)
  • mto: This revision was merged to the branch mainline in revision 13555.
  • Revision ID: julian.edwards@canonical.com-20110728204618-tivj2wx2oa9s32bx
merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright 2009-2011 Canonical Ltd.  This software is licensed under the
 
1
# Copyright 2009-2010 Canonical Ltd.  This software is licensed under the
2
2
# GNU Affero General Public License version 3 (see the file LICENSE).
3
3
 
4
4
"""Common helpers for codehosting tests."""
26
26
    TestNotApplicable,
27
27
    TestSkipped,
28
28
    )
29
 
from testtools.deferredruntest import AsynchronousDeferredRunTest
 
29
 
 
30
from testtools.deferredruntest import (
 
31
    AsynchronousDeferredRunTest,
 
32
    )
 
33
 
30
34
from twisted.internet import (
31
35
    defer,
32
36
    threads,
112
116
    """
113
117
    def decorated(*args, **kwargs):
114
118
        d = defer.Deferred()
115
 
 
116
119
        def runInThread():
117
120
            return threads._putResultInDeferred(d, f, args, kwargs)
118
121
 
126
129
    """Return a clone of the given test."""
127
130
    from copy import deepcopy
128
131
    new_test = deepcopy(test)
129
 
 
130
132
    def make_new_test_id():
131
133
        return lambda: new_id
132
 
 
133
134
    new_test.id = make_new_test_id()
134
135
    return new_test
135
136
 
159
160
        "Can only create branches for HOSTED branches: %r"
160
161
        % db_branch)
161
162
    branch_dir = os.path.join(
162
 
        config.codehosting.mirrored_branches_root,
 
163
        config.codehosting.hosted_branches_root,
163
164
        branch_id_to_path(db_branch.id))
164
165
    return create_branch_with_one_revision(branch_dir)
165
166