← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~cjwatson/launchpad/testfix-buildmaster-cancel-properly into lp:launchpad

 

Colin Watson has proposed merging lp:~cjwatson/launchpad/testfix-buildmaster-cancel-properly into lp:launchpad.

Commit message:
Fix several tests to cope with non-virtual builds being cancellable.

Requested reviews:
  Colin Watson (cjwatson)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/testfix-buildmaster-cancel-properly/+merge/182986

https://code.launchpad.net/~cjwatson/launchpad/buildmaster-cancel-properly/+merge/177580 caused three test failures due to non-virtual builds now being cancellable.  This branch fixes those.
-- 
https://code.launchpad.net/~cjwatson/launchpad/testfix-buildmaster-cancel-properly/+merge/182986
Your team Launchpad code reviewers is subscribed to branch lp:launchpad.
=== modified file 'lib/lp/soyuz/browser/tests/test_build_views.py'
--- lib/lp/soyuz/browser/tests/test_build_views.py	2013-03-27 03:37:03 +0000
+++ lib/lp/soyuz/browser/tests/test_build_views.py	2013-08-29 18:45:29 +0000
@@ -1,4 +1,4 @@
-# Copyright 2011 Canonical Ltd.  This software is licensed under the
+# Copyright 2011-2013 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 __metaclass__ = type
@@ -305,10 +305,9 @@
 
     def test_cancelling_uncancellable_build(self):
         archive = self.factory.makeArchive(purpose=ArchivePurpose.PRIMARY)
-        removeSecurityProxy(archive).require_virtualized = False
         pending_build = self.factory.makeBinaryPackageBuild(archive=archive)
         pending_build.queueBuild()
-        pending_build.updateStatus(BuildStatus.BUILDING)
+        pending_build.updateStatus(BuildStatus.FAILEDTOBUILD)
         with person_logged_in(archive.owner):
             view = create_initialized_view(
                 pending_build, name="+cancel", form={
@@ -316,7 +315,7 @@
         notification = view.request.response.notifications[0]
         self.assertEqual(
             notification.message, "Unable to cancel build.")
-        self.assertEqual(BuildStatus.BUILDING, pending_build.status)
+        self.assertEqual(BuildStatus.FAILEDTOBUILD, pending_build.status)
 
     def test_build_records_view(self):
         # The BuildRecordsView can also be used to filter by architecture tag.

=== modified file 'lib/lp/soyuz/stories/soyuz/xx-build-record.txt'
--- lib/lp/soyuz/stories/soyuz/xx-build-record.txt	2013-04-17 16:45:13 +0000
+++ lib/lp/soyuz/stories/soyuz/xx-build-record.txt	2013-08-29 18:45:29 +0000
@@ -144,6 +144,7 @@
     >>> print extract_text(find_tag_by_id(admin_browser.contents, 'status'))
     Build status
     Needs building
+    Cancel build
     Start in ...
     Build score:0 Rescore build (What's this?)
 
@@ -294,6 +295,7 @@
     >>> print extract_text(find_tag_by_id(admin_browser.contents, 'status'))
     Build status
     Needs building
+    Cancel build
     Start in ...
     Build score:... Rescore build (What's this?)
 

=== modified file 'lib/lp/soyuz/tests/test_binarypackagebuild.py'
--- lib/lp/soyuz/tests/test_binarypackagebuild.py	2013-02-04 06:14:32 +0000
+++ lib/lp/soyuz/tests/test_binarypackagebuild.py	2013-08-29 18:45:29 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009-2012 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2013 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Test Build features."""
@@ -144,12 +144,12 @@
                 self.assertFalse(self.build.can_be_cancelled)
 
     def test_can_be_cancelled_virtuality(self):
-        # Only virtual builds can be cancelled.
+        # Both virtual and non-virtual builds can be cancelled.
         bq = removeSecurityProxy(self.build.queueBuild())
         bq.virtualized = True
         self.assertTrue(self.build.can_be_cancelled)
         bq.virtualized = False
-        self.assertFalse(self.build.can_be_cancelled)
+        self.assertTrue(self.build.can_be_cancelled)
 
     def test_cancel_not_in_progress(self):
         # Testing the cancel() method for a pending build should leave


References