~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/code/model/tests/test_sourcepackagerecipebuild.py

[r=allenap][bug=905853, 905855,
        906079] Revert r14499 and r14459 because read-only transactions in
        buildmaster are causing production issues.

Show diffs side-by-side

added added

removed removed

Lines of Context:
13
13
 
14
14
from pytz import utc
15
15
from storm.locals import Store
16
 
from testtools.deferredruntest import AsynchronousDeferredRunTest
17
16
import transaction
 
17
from twisted.trial.unittest import TestCase as TrialTestCase
18
18
from zope.component import getUtility
19
19
from zope.security.proxy import removeSecurityProxy
20
20
 
28
28
from lp.app.errors import NotFoundError
29
29
from lp.buildmaster.enums import BuildStatus
30
30
from lp.buildmaster.interfaces.buildqueue import IBuildQueue
31
 
from lp.buildmaster.model.builder import BuilderSlave
32
31
from lp.buildmaster.model.buildfarmjob import BuildFarmJob
33
32
from lp.buildmaster.model.packagebuild import PackageBuild
34
33
from lp.buildmaster.tests.mock_slaves import WaitingSlave
589
588
        self.assertEquals(0, len(notifications))
590
589
 
591
590
 
592
 
class TestBuildNotifications(TestCaseWithFactory):
 
591
class TestBuildNotifications(TrialTestCase):
593
592
 
594
593
    layer = LaunchpadZopelessLayer
595
594
 
596
 
    run_tests_with = AsynchronousDeferredRunTest.make_factory(timeout=20)
 
595
    def setUp(self):
 
596
        super(TestBuildNotifications, self).setUp()
 
597
        from lp.testing.factory import LaunchpadObjectFactory
 
598
        self.factory = LaunchpadObjectFactory()
597
599
 
598
600
    def prepare_build(self, fake_successful_upload=False):
599
601
        queue_record = self.factory.makeSourcePackageRecipeBuildJob()
606
608
                result=True)
607
609
        queue_record.builder = self.factory.makeBuilder()
608
610
        slave = WaitingSlave('BuildStatus.OK')
609
 
        self.patch(BuilderSlave, 'makeBuilderSlave', FakeMethod(slave))
 
611
        queue_record.builder.setSlaveForTesting(slave)
610
612
        return build
611
613
 
612
614
    def assertDeferredNotifyCount(self, status, build, expected_count):
664
666
 
665
667
 
666
668
class TestHandleStatusForSPRBuild(
667
 
    MakeSPRecipeBuildMixin, TestHandleStatusMixin, TestCaseWithFactory):
 
669
    MakeSPRecipeBuildMixin, TestHandleStatusMixin, TrialTestCase):
668
670
    """IPackageBuild.handleStatus works with SPRecipe builds."""