~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: 2011-06-24 22:40:32 UTC
  • mfrom: (13278.2.9 resubmit-inactive)
  • Revision ID: launchpad@pqm.canonical.com-20110624224032-uqsvjzv8dp4ozw9l
[r=bac][bug=618866] Show user error on resubmit with active proposal

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
    'BrowserTestCase',
16
16
    'build_yui_unittest_suite',
17
17
    'celebrity_logged_in',
 
18
    'ExpectedException',
18
19
    'FakeTime',
19
20
    'get_lsb_information',
20
21
    'is_logged_in',
95
96
from testtools.content import Content
96
97
from testtools.content_type import UTF8_TEXT
97
98
from testtools.matchers import MatchesRegex
 
99
from testtools.testcase import ExpectedException as TTExpectedException
98
100
import transaction
99
101
from windmill.authoring import WindmillTestClient
100
102
from zope.component import (
1350
1352
            source_package.productseries,
1351
1353
            source_package.sourcepackagename,
1352
1354
            source_package.distroseries)
 
1355
 
 
1356
 
 
1357
class ExpectedException(TTExpectedException):
 
1358
    """An ExpectedException that provides access to the caught exception."""
 
1359
 
 
1360
    def __init__(self, exc_type, value_re):
 
1361
        super(ExpectedException, self).__init__(exc_type, value_re)
 
1362
        self.caught_exc = None
 
1363
 
 
1364
    def __exit__(self, exc_type, exc_value, traceback):
 
1365
        self.caught_exc = exc_value
 
1366
        return super(ExpectedException, self).__exit__(
 
1367
            exc_type, exc_value, traceback)