launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #03718
[Merge] lp:~abentley/launchpad/handle-concurrent-lint into lp:launchpad
Aaron Bentley has proposed merging lp:~abentley/launchpad/handle-concurrent-lint into lp:launchpad.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~abentley/launchpad/handle-concurrent-lint/+merge/62139
= Summary =
Lint cleanups for retry-job (which fixes 787588)
== Proposed fix ==
Misc
== Pre-implementation notes ==
None
== Implementation details ==
Switched from RegexMatcher to MatchesRegex, the testtools version.
Added blank lines above nested functions.
== Tests ==
bin/test -t test_packaging_translations -t test_runner
== Demo and Q/A ==
None
= Launchpad lint =
Checking for conflicts and issues in changed files.
Linting changed files:
lib/lp/translations/scripts/tests/test_packaging_translations.py
lib/lp/services/job/tests/test_runner.py
lib/lp/testing/__init__.py
--
https://code.launchpad.net/~abentley/launchpad/handle-concurrent-lint/+merge/62139
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~abentley/launchpad/handle-concurrent-lint into lp:launchpad.
=== modified file 'lib/lp/services/job/tests/test_runner.py'
--- lib/lp/services/job/tests/test_runner.py 2011-03-23 20:21:24 +0000
+++ lib/lp/services/job/tests/test_runner.py 2011-05-24 14:39:14 +0000
@@ -161,6 +161,7 @@
def test_runAll_reports_oopses(self):
"""When an error is encountered, report an oops and continue."""
job_1, job_2 = self.makeTwoJobs()
+
def raiseError():
# Ensure that jobs which call transaction.abort work, too.
transaction.abort()
@@ -181,6 +182,7 @@
def test_oops_messages_used_when_handling(self):
"""Oops messages should appear even when exceptions are handled."""
job_1, job_2 = self.makeTwoJobs()
+
def handleError():
reporter = errorlog.globalErrorUtility
try:
@@ -216,6 +218,7 @@
def test_runAll_mails_oopses(self):
"""Email interested parties about OOPses."""
job_1, job_2 = self.makeTwoJobs()
+
def raiseError():
# Ensure that jobs which call transaction.abort work, too.
transaction.abort()
@@ -243,8 +246,10 @@
error messages are mailed to interested parties verbatim.
"""
job_1, job_2 = self.makeTwoJobs()
+
class ExampleError(Exception):
pass
+
def raiseError():
raise ExampleError('Fake exception. Foobar, I say!')
job_1.run = raiseError
@@ -272,6 +277,7 @@
"""
runner = JobRunner([object()])
self.assertRaises(TypeError, runner.runAll)
+
class Runnable:
implements(IRunnableJob)
runner = JobRunner([Runnable()])
=== modified file 'lib/lp/testing/__init__.py'
--- lib/lp/testing/__init__.py 2011-05-13 17:23:27 +0000
+++ lib/lp/testing/__init__.py 2011-05-24 14:39:14 +0000
@@ -91,7 +91,6 @@
import testtools
from testtools.content import Content
from testtools.content_type import UTF8_TEXT
-from testtools.matchers import Matcher, Mismatch
import transaction
from windmill.authoring import WindmillTestClient
from zope.component import (
@@ -1323,26 +1322,3 @@
source_package.productseries,
source_package.sourcepackagename,
source_package.distroseries)
-
-
-class RegexMatcher(Matcher):
- """A matcher that matches a regular expression."""
-
- def __init__(self, pattern, flags=0):
- """Constructor.
-
- :param pattern: The pattern to match.
- :param flags: The flags to use when performing the match.
- """
- self.pattern = pattern
- self.flags = flags
-
- def match(self, something):
- """See `Matcher`."""
- if re.match(self.pattern, something, self.flags):
- return None
- return Mismatch('Pattern "%s" not in "%s".' % (self.pattern, something))
-
- def __str__(self):
- """See `Matcher`."""
- return 'RegexMatcher(%r)' % self.pattern
=== modified file 'lib/lp/translations/scripts/tests/test_packaging_translations.py'
--- lib/lp/translations/scripts/tests/test_packaging_translations.py 2011-05-13 16:18:27 +0000
+++ lib/lp/translations/scripts/tests/test_packaging_translations.py 2011-05-24 14:39:14 +0000
@@ -6,13 +6,14 @@
from textwrap import dedent
+from testtools.matchers import MatchesRegex
import transaction
from canonical.launchpad.scripts.tests import run_script
from canonical.testing.layers import ZopelessAppServerLayer
from lp.translations.model.translationpackagingjob import (
TranslationSplitJob)
-from lp.testing import RegexMatcher, TestCaseWithFactory
+from lp.testing import TestCaseWithFactory
from lp.translations.tests.test_translationpackagingjob import (
make_translation_merge_job,
)
@@ -30,7 +31,7 @@
retcode, stdout, stderr = run_script(
'cronscripts/run_jobs.py', ['packaging_translations'],
expect_returncode=0)
- matcher = RegexMatcher(dedent("""\
+ matcher = MatchesRegex(dedent("""\
INFO Creating lockfile: /var/lock/launchpad-jobcronscript.lock
INFO Running synchronously.
INFO Merging .* and .* in Ubuntu Distroseries.*