~launchpad-pqm/launchpad/devel

« back to all changes in this revision

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

Merged bug-824435-failure-reporting-2 into bug-824435-failure-reporting-3.

Show diffs side-by-side

added added

removed removed

Lines of Context:
437
437
                'Events were generated: %s.' % event_list)
438
438
        return result
439
439
 
 
440
    @contextmanager
 
441
    def noOops(self):
 
442
        oops = errorlog.globalErrorUtility.getLastOopsReport()
 
443
        try:
 
444
            yield
 
445
        finally:
 
446
            self.assertNoNewOops(oops)
 
447
 
440
448
    def assertNoNewOops(self, old_oops):
441
449
        """Assert that no oops has been recorded since old_oops."""
442
450
        oops = errorlog.globalErrorUtility.getLastOopsReport()
443
451
        if old_oops is None:
444
452
            self.assertIs(None, oops)
445
453
        else:
446
 
            self.assertEqual(oops.id, old_oops.id)
 
454
            self.assertTrue(
 
455
                oops.id == old_oops.id, 'Oops recorded: %s' % oops.id)
447
456
 
448
457
    def assertSqlAttributeEqualsDate(self, sql_object, attribute_name, date):
449
458
        """Fail unless the value of the attribute is equal to the date.