← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~lifeless/launchpad/testtools into lp:launchpad/devel

 

Robert Collins has proposed merging lp:~lifeless/launchpad/testtools into lp:launchpad/devel.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)


Update to testtools 0.9.7, this includes matchers we previously had in tree as well as supporting accurate test timings in the parallel test mode.
-- 
https://code.launchpad.net/~lifeless/launchpad/testtools/+merge/38665
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~lifeless/launchpad/testtools into lp:launchpad/devel.
=== modified file 'lib/canonical/launchpad/database/tests/test_stormextensions.py'
--- lib/canonical/launchpad/database/tests/test_stormextensions.py	2010-08-20 20:31:18 +0000
+++ lib/canonical/launchpad/database/tests/test_stormextensions.py	2010-10-17 18:27:50 +0000
@@ -46,7 +46,7 @@
                           case_sensitive=False)
 
     def test_StartsWithUse(self):
-        """StartWith correctly performs searches."""
+        """StartsWith correctly performs searches."""
 
         person1 = self.factory.makePerson(name='aa', displayname="John Doe")
         person2 = self.factory.makePerson(name='bb', displayname="Johan Doe")

=== modified file 'lib/lp/bugs/model/tests/test_bug.py'
--- lib/lp/bugs/model/tests/test_bug.py	2010-10-15 16:11:17 +0000
+++ lib/lp/bugs/model/tests/test_bug.py	2010-10-17 18:27:50 +0000
@@ -6,6 +6,7 @@
 __metaclass__ = type
 
 from storm.store import ResultSet
+from testtools.matchers import StartsWith
 
 from canonical.testing.layers import DatabaseFunctionalLayer
 from lp.bugs.mail.bugnotificationrecipients import BugNotificationRecipients
@@ -17,7 +18,6 @@
     person_logged_in,
     TestCaseWithFactory,
     )
-from lp.testing.matchers import StartsWith
 
 
 class TestBug(TestCaseWithFactory):

=== modified file 'lib/lp/testing/matchers.py'
--- lib/lp/testing/matchers.py	2010-09-19 23:52:49 +0000
+++ lib/lp/testing/matchers.py	2010-10-17 18:27:50 +0000
@@ -5,13 +5,11 @@
 __all__ = [
     'DoesNotCorrectlyProvide',
     'DoesNotProvide',
-    'DoesNotStartWith',
     'HasQueryCount',
     'IsNotProxied',
     'IsProxied',
     'Provides',
     'ProvidesAndIsProxied',
-    'StartsWith',
     ]
 
 from testtools.content import Content
@@ -191,42 +189,6 @@
         return IsProxied().match(matchee)
 
 
-class DoesNotStartWith(Mismatch):
-
-    def __init__(self, matchee, expected):
-        """Create a DoesNotStartWith Mismatch.
-
-        :param matchee: the string that did not match.
-        :param expected: the string that `matchee` was expected to start
-            with.
-        """
-        self.matchee = matchee
-        self.expected = expected
-
-    def describe(self):
-        return "'%s' does not start with '%s'." % (
-            self.matchee, self.expected)
-
-
-class StartsWith(Matcher):
-    """Checks whether one string starts with another."""
-
-    def __init__(self, expected):
-        """Create a StartsWith Matcher.
-
-        :param expected: the string that matchees should start with.
-        """
-        self.expected = expected
-
-    def __str__(self):
-        return "Starts with '%s'." % self.expected
-
-    def match(self, matchee):
-        if not matchee.startswith(self.expected):
-            return DoesNotStartWith(matchee, self.expected)
-        return None
-
-
 class IsConfiguredBatchNavigator(Matcher):
     """Check that an object is a batch navigator."""
 

=== modified file 'lib/lp/testing/tests/test_factory.py'
--- lib/lp/testing/tests/test_factory.py	2010-09-21 18:43:27 +0000
+++ lib/lp/testing/tests/test_factory.py	2010-10-17 18:27:50 +0000
@@ -9,6 +9,7 @@
 import unittest
 
 import pytz
+from testtools.matchers import StartsWith
 from zope.component import getUtility
 from zope.security.proxy import removeSecurityProxy
 
@@ -58,7 +59,6 @@
     IsProxied,
     Provides,
     ProvidesAndIsProxied,
-    StartsWith,
     )
 
 

=== modified file 'lib/lp/testing/tests/test_matchers.py'
--- lib/lp/testing/tests/test_matchers.py	2010-08-20 20:31:18 +0000
+++ lib/lp/testing/tests/test_matchers.py	2010-10-17 18:27:50 +0000
@@ -22,13 +22,11 @@
 from lp.testing.matchers import (
     DoesNotCorrectlyProvide,
     DoesNotProvide,
-    DoesNotStartWith,
     HasQueryCount,
     IsNotProxied,
     IsProxied,
     Provides,
     ProvidesAndIsProxied,
-    StartsWith,
     )
 
 
@@ -224,36 +222,3 @@
         self.assertEqual(
             "queries do not match: %s" % (LessThan(2).match(2).describe(),),
             mismatch.describe())
-
-
-class DoesNotStartWithTests(TestCase):
-
-    def test_describe(self):
-        mismatch = DoesNotStartWith("foo", "bar")
-        self.assertEqual(
-            "'foo' does not start with 'bar'.", mismatch.describe())
-
-
-class StartsWithTests(TestCase):
-
-    def test_str(self):
-        matcher = StartsWith("bar")
-        self.assertEqual("Starts with 'bar'.", str(matcher))
-
-    def test_match(self):
-        matcher = StartsWith("bar")
-        self.assertIs(None, matcher.match("barf"))
-
-    def test_mismatch_returns_does_not_start_with(self):
-        matcher = StartsWith("bar")
-        self.assertIsInstance(matcher.match("foo"), DoesNotStartWith)
-
-    def test_mismatch_sets_matchee(self):
-        matcher = StartsWith("bar")
-        mismatch = matcher.match("foo")
-        self.assertEqual("foo", mismatch.matchee)
-
-    def test_mismatch_sets_expected(self):
-        matcher = StartsWith("bar")
-        mismatch = matcher.match("foo")
-        self.assertEqual("bar", mismatch.expected)

=== modified file 'versions.cfg'
--- versions.cfg	2010-10-15 04:53:38 +0000
+++ versions.cfg	2010-10-17 18:27:50 +0000
@@ -69,7 +69,7 @@
 # 0.17 plus r374 from storm trunk for fixing lp:620508 (in order to address
 # lp:627442).
 storm = 0.17-launchpad-1
-testtools = 0.9.6
+testtools = 0.9.7
 transaction = 1.0.0
 Twisted = 10.1.0
 uuid = 1.30