← Back to team overview

launchpad-reviewers team mailing list archive

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

 

Michael Hudson-Doyle has proposed merging lp:~mwhudson/launchpad/testtools into lp:launchpad/devel with lp:~lifeless/launchpad/testtools as a prerequisite.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)


I fixed some fallout from the prerequisite branch.
-- 
https://code.launchpad.net/~mwhudson/launchpad/testtools/+merge/38896
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~mwhudson/launchpad/testtools into lp:launchpad/devel.
=== modified file 'lib/lp/code/model/branchjob.py'
--- lib/lp/code/model/branchjob.py	2010-08-20 20:31:18 +0000
+++ lib/lp/code/model/branchjob.py	2010-10-19 22:23:07 +0000
@@ -54,6 +54,7 @@
     classProvides,
     implements,
     )
+from zope.security.proxy import removeSecurityProxy
 
 from canonical.config import config
 from canonical.database.enumcol import EnumCol
@@ -229,8 +230,9 @@
     # XXX: henninge 2009-02-20 bug=331919: These two standard operators
     # should be implemented by delegates().
     def __eq__(self, other):
-        return (self.__class__ == other.__class__ and
-                self.context == other.context)
+        if self.__class__ != other.__class__:
+            return False
+        return self.context == removeSecurityProxy(other).context
 
     def __ne__(self, other):
         return not (self == other)

=== modified file 'lib/lp/code/model/tests/test_branchpuller.py'
--- lib/lp/code/model/tests/test_branchpuller.py	2010-08-20 20:31:18 +0000
+++ lib/lp/code/model/tests/test_branchpuller.py	2010-10-19 22:23:07 +0000
@@ -61,7 +61,7 @@
         """requestMirror sets the mirror request time to 'now'."""
         branch = self.makeAnyBranch()
         branch.requestMirror()
-        self.assertEqual(UTC_NOW, branch.next_mirror_time)
+        self.assertSqlAttributeEqualsDate(branch, 'next_mirror_time', UTC_NOW)
 
     def test_requestMirror_doesnt_demote_branch(self):
         # requestMirror() sets the mirror request time to 'now' unless
@@ -78,10 +78,10 @@
         # requestMirror() sets the mirror request time to 'now' if
         # next_mirror_time is set and in the future.
         branch = self.makeAnyBranch()
-        future_time = datetime.now(pytz.UTC) - timedelta(days=1)
+        future_time = datetime.now(pytz.UTC) + timedelta(days=1)
         removeSecurityProxy(branch).next_mirror_time = future_time
         branch.requestMirror()
-        self.assertEqual(UTC_NOW, branch.next_mirror_time)
+        self.assertSqlAttributeEqualsDate(branch, 'next_mirror_time', UTC_NOW)
 
     def test_mirroringResetsMirrorRequest(self):
         """Mirroring branches resets their mirror request times."""


Follow ups