Rev 4655: Use copy, not deepcopy, to clone tests in test parameterisation. in http://bazaar.launchpad.net/~lifeless/bzr/test-speed

Robert Collins robertc at robertcollins.net
Wed Aug 26 08:02:50 BST 2009


At http://bazaar.launchpad.net/~lifeless/bzr/test-speed

------------------------------------------------------------
revno: 4655
revision-id: robertc at robertcollins.net-20090826070245-myz71im24m39vdwc
parent: robertc at robertcollins.net-20090826063313-03jc5xen4lk6at8q
committer: Robert Collins <robertc at robertcollins.net>
branch nick: test-speed
timestamp: Wed 2009-08-26 17:02:45 +1000
message:
  Use copy, not deepcopy, to clone tests in test parameterisation.
=== modified file 'NEWS'
--- a/NEWS	2009-08-25 23:37:34 +0000
+++ b/NEWS	2009-08-26 07:02:45 +0000
@@ -92,6 +92,10 @@
 * Passing ``--lsprof-tests -v`` to bzr selftest will cause lsprof output to
   be output for every test. Note that this is very verbose! (Robert Collins)
 
+* Test parameterisation now does a shallow copy, not a deep copy of the test
+  to be parameterised. This is not expected to break external use of test
+  parameterisation, and is substantially faster. (Robert Collins)
+
 bzr 1.18
 ########
 

=== modified file 'bzrlib/tests/__init__.py'
--- a/bzrlib/tests/__init__.py	2009-08-26 06:21:10 +0000
+++ b/bzrlib/tests/__init__.py	2009-08-26 07:02:45 +0000
@@ -28,6 +28,7 @@
 
 import atexit
 import codecs
+from copy import copy
 from cStringIO import StringIO
 import difflib
 import doctest
@@ -3880,8 +3881,7 @@
     :param new_id: The id to assign to it.
     :return: The new test.
     """
-    from copy import deepcopy
-    new_test = deepcopy(test)
+    new_test = copy(test)
     new_test.id = lambda: new_id
     return new_test
 




More information about the bazaar-commits mailing list