Rev 3622: Allow addCleanup to take arguments, in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Wed Aug 13 03:54:09 BST 2008
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 3622
revision-id: pqm at pqm.ubuntu.com-20080813025404-kmul7igvg0d7w4va
parent: pqm at pqm.ubuntu.com-20080813020322-v230uatfihz5zfm6
parent: jml at canonical.com-20080813021301-9n2qhopsv5jk929r
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Wed 2008-08-13 03:54:04 +0100
message:
Allow addCleanup to take arguments,
and remove addCleanup's uniqueness constraint. (Jonathan Lange)
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/tests/__init__.py selftest.py-20050531073622-8d0e3c8845c97a64
------------------------------------------------------------
revno: 3620.1.2
revision-id: jml at canonical.com-20080813021301-9n2qhopsv5jk929r
parent: jml at canonical.com-20080813013046-b9voimnnr9eghlbz
committer: Jonathan Lange <jml at canonical.com>
branch nick: addCleanup-args
timestamp: Wed 2008-08-13 12:13:01 +1000
message:
Add an entry for addCleanup changes.
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
------------------------------------------------------------
revno: 3620.1.1
revision-id: jml at canonical.com-20080813013046-b9voimnnr9eghlbz
parent: pqm at pqm.ubuntu.com-20080812201855-9qxbdo0t2h9byzhj
committer: Jonathan Lange <jml at canonical.com>
branch nick: addCleanup-args
timestamp: Wed 2008-08-13 11:30:46 +1000
message:
Let addCleanup take arguments that are then passed to the cleanup.
modified:
bzrlib/tests/__init__.py selftest.py-20050531073622-8d0e3c8845c97a64
=== modified file 'NEWS'
--- a/NEWS 2008-08-11 03:39:25 +0000
+++ b/NEWS 2008-08-13 02:13:01 +0000
@@ -36,6 +36,13 @@
* Exporters now take 4 parameters. (Robert Collins)
+ TESTING:
+
+ * ``addCleanup`` now takes ``*arguments`` and ``**keyword_arguments``
+ which are then passed to the cleanup callable as it is run. In
+ addition, addCleanup no longer requires that the callables passed to
+ it be unique. (Jonathan Lange)
+
INTERNALS:
=== modified file 'bzrlib/tests/__init__.py'
--- a/bzrlib/tests/__init__.py 2008-08-11 02:04:00 +0000
+++ b/bzrlib/tests/__init__.py 2008-08-13 01:30:46 +0000
@@ -1196,16 +1196,13 @@
"""Make the logfile not be deleted when _finishLogFile is called."""
self._keep_log_file = True
- def addCleanup(self, callable):
+ def addCleanup(self, callable, *args, **kwargs):
"""Arrange to run a callable when this case is torn down.
Callables are run in the reverse of the order they are registered,
ie last-in first-out.
"""
- if callable in self._cleanups:
- raise ValueError("cleanup function %r already registered on %s"
- % (callable, self))
- self._cleanups.append(callable)
+ self._cleanups.append((callable, args, kwargs))
def _cleanEnvironment(self):
new_env = {
@@ -1320,7 +1317,8 @@
# Actually pop the cleanups from the list so tearDown running
# twice is safe (this happens for skipped tests).
while self._cleanups:
- self._cleanups.pop()()
+ cleanup, args, kwargs = self._cleanups.pop()
+ cleanup(*args, **kwargs)
def log(self, *args):
mutter(*args)
More information about the bazaar-commits
mailing list