~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/testing/__init__.py

  • Committer: Launchpad Patch Queue Manager
  • Date: 2010-08-27 16:05:50 UTC
  • mfrom: (11457.2.3 fakelibrarian-fixture)
  • Revision ID: launchpad@pqm.canonical.com-20100827160550-30vrwdktf17tb2mx
[r=julian-edwards][ui=none][no-qa] Make FakeLibrarian a fixture;
        ignore debugID parameter to create().

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
 
4
4
# pylint: disable-msg=W0401,C0301,F0401
5
5
 
6
 
 
7
6
from __future__ import with_statement
8
7
 
9
8
 
287
286
        `addCleanup`).
288
287
 
289
288
        :param fixture: Any object that has a `setUp` and `tearDown` method.
 
289
        :return: `fixture`.
290
290
        """
291
291
        fixture.setUp()
292
292
        self.addCleanup(fixture.tearDown)
 
293
        return fixture
293
294
 
294
295
    def __str__(self):
295
296
        """The string representation of a test is its id.
575
576
        bzr_branch = self.createBranchAtURL(db_branch.getInternalBzrUrl())
576
577
        if parent:
577
578
            bzr_branch.pull(parent)
578
 
            removeSecurityProxy(db_branch).last_scanned_id = bzr_branch.last_revision()
 
579
            naked_branch = removeSecurityProxy(db_branch)
 
580
            naked_branch.last_scanned_id = bzr_branch.last_revision()
579
581
        return bzr_branch
580
582
 
581
583
    @staticmethod
631
633
    This testcase provides an API similar to page tests, and can be used for
632
634
    cases when one wants a unit test and not a frakking pagetest.
633
635
    """
 
636
 
634
637
    def setUp(self):
635
638
        """Provide useful defaults."""
636
639
        super(BrowserTestCase, self).setUp()
764
767
        # unlikely that any one approach is going to work for every
765
768
        # class. It's better to fail early and draw attention here.
766
769
        assert isinstance(result, ZopeTestResult), (
767
 
            "result must be a Zope result object, not %r." % (result,))
 
770
            "result must be a Zope result object, not %r." % (result, ))
768
771
        pread, pwrite = os.pipe()
769
772
        pid = os.fork()
770
773
        if pid == 0: