~launchpad-pqm/launchpad/devel

« back to all changes in this revision

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

  • Committer: Raphael Badin
  • Date: 2012-01-06 08:27:55 UTC
  • mfrom: (14513.5.4 builder-history-lfa)
  • mto: This revision was merged to the branch mainline in revision 14654.
  • Revision ID: raphael.badin@canonical.com-20120106082755-95a0eh6nakv5hj3b
Merge devel.

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
16
17
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
 
21
21
from lp.app.errors import NotFoundError
22
22
from lp.buildmaster.enums import BuildStatus
23
23
from lp.buildmaster.interfaces.buildqueue import IBuildQueue
 
24
from lp.buildmaster.model.builder import BuilderSlave
24
25
from lp.buildmaster.model.buildfarmjob import BuildFarmJob
25
26
from lp.buildmaster.model.packagebuild import PackageBuild
26
27
from lp.buildmaster.tests.mock_slaves import WaitingSlave
588
589
        self.assertEquals(0, len(notifications))
589
590
 
590
591
 
591
 
class TestBuildNotifications(TrialTestCase):
 
592
class TestBuildNotifications(TestCaseWithFactory):
592
593
 
593
594
    layer = LaunchpadZopelessLayer
594
595
 
595
 
    def setUp(self):
596
 
        super(TestBuildNotifications, self).setUp()
597
 
        from lp.testing.factory import LaunchpadObjectFactory
598
 
        self.factory = LaunchpadObjectFactory()
 
596
    run_tests_with = AsynchronousDeferredRunTest.make_factory(timeout=20)
599
597
 
600
598
    def prepare_build(self, fake_successful_upload=False):
601
599
        queue_record = self.factory.makeSourcePackageRecipeBuildJob()
608
606
                result=True)
609
607
        queue_record.builder = self.factory.makeBuilder()
610
608
        slave = WaitingSlave('BuildStatus.OK')
611
 
        queue_record.builder.setSlaveForTesting(slave)
 
609
        self.patch(BuilderSlave, 'makeBuilderSlave', FakeMethod(slave))
612
610
        return build
613
611
 
614
612
    def assertDeferredNotifyCount(self, status, build, expected_count):
666
664
 
667
665
 
668
666
class TestHandleStatusForSPRBuild(
669
 
    MakeSPRecipeBuildMixin, TestHandleStatusMixin, TrialTestCase):
 
667
    MakeSPRecipeBuildMixin, TestHandleStatusMixin, TestCaseWithFactory):
670
668
    """IPackageBuild.handleStatus works with SPRecipe builds."""