736
736
"Did not find expected marker for %s."
737
737
% archive.purpose.title)
739
def test_publish_reraises_exception(self):
740
# If an Exception comes up while publishing, it bubbles up out
741
# of the publish method even though the method must intercept
742
# it for its own purposes.
743
class MoonPhaseError(Exception):
744
"""Simulated failure."""
746
message = self.factory.getUniqueString()
747
script = self.makeScript()
748
script.publishAllUploads = FakeMethod(failure=MoonPhaseError(message))
750
self.assertRaisesWithContent(MoonPhaseError, message, script.publish)
752
def test_publish_obeys_keyboard_interrupt(self):
753
# Similar to an Exception, a keyboard interrupt does not get
755
message = self.factory.getUniqueString()
756
script = self.makeScript()
757
script.publishAllUploads = FakeMethod(
758
failure=KeyboardInterrupt(message))
760
self.assertRaisesWithContent(
761
KeyboardInterrupt, message, script.publish)
763
def test_publish_recovers_working_dists_on_exception(self):
764
# If an Exception comes up while publishing, the publish method
765
# recovers its working directory.
766
class MoonPhaseError(Exception):
767
"""Simulated failure."""
769
failure = MoonPhaseError(self.factory.getUniqueString())
771
script = self.makeScript()
772
script.publishAllUploads = FakeMethod(failure=failure)
773
script.recoverArchiveWorkingDir = FakeMethod()
778
except MoonPhaseError:
781
self.assertEqual(1, script.recoverArchiveWorkingDir.call_count)
783
def test_publish_recovers_working_dists_on_ctrl_C(self):
784
# If the user hits ctrl-C while publishing, the publish method
785
# recovers its working directory.
786
failure = KeyboardInterrupt("Ctrl-C!")
788
script = self.makeScript()
789
script.publishAllUploads = FakeMethod(failure=failure)
790
script.recoverArchiveWorkingDir = FakeMethod()
795
except KeyboardInterrupt:
798
self.assertEqual(1, script.recoverArchiveWorkingDir.call_count)
740
801
class TestCreateDistroSeriesIndexes(TestCaseWithFactory, HelpersMixin):
741
802
"""Test initial creation of archive indexes for a `DistroSeries`."""