Rev 2238: Disconnect RemoteTransports in some tests to avoid tripping up test_strace with leftover threads from previous tests. in sftp://bazaar.launchpad.net/%7Ebzr/bzr/hpss/

Andrew Bennetts andrew.bennetts at canonical.com
Thu Apr 19 15:57:02 BST 2007


At sftp://bazaar.launchpad.net/%7Ebzr/bzr/hpss/

------------------------------------------------------------
revno: 2238
revision-id: andrew.bennetts at canonical.com-20070419145520-3j94u46y5zfh0ybq
parent: andrew.bennetts at canonical.com-20070419042920-fwr334s98mbcxh5e
parent: andrew.bennetts at canonical.com-20070411051706-i5k643i402dtvzu3
committer: Andrew Bennetts <andrew.bennetts at canonical.com>
branch nick: hpss
timestamp: Fri 2007-04-20 00:55:20 +1000
message:
  Disconnect RemoteTransports in some tests to avoid tripping up test_strace with leftover threads from previous tests.
modified:
  bzrlib/tests/test_lockable_files.py test_lockable_files.py-20051225183927-365c7fd99591caf1
  bzrlib/tests/test_remote.py    test_remote.py-20060720103555-yeeg2x51vn0rbtdp-2
  bzrlib/tests/test_smart_transport.py test_ssh_transport.py-20060608202016-c25gvf1ob7ypbus6-2
    ------------------------------------------------------------
    revno: 2018.1.2.1.50.2.80.1.99.1.9.1.21.1.26.2.74.2.2.2.23.1.1
    merged: andrew.bennetts at canonical.com-20070411051706-i5k643i402dtvzu3
    parent: pqm at pqm.ubuntu.com-20070411022359-403a2155afb207cf
    committer: Andrew Bennetts <andrew.bennetts at canonical.com>
    branch nick: faster-tests
    timestamp: Wed 2007-04-11 15:17:06 +1000
    message:
      Remove temporary directories from successful tests as soon as possible, thus making the full test suite much much faster.
=== modified file 'bzrlib/tests/test_lockable_files.py'
--- a/bzrlib/tests/test_lockable_files.py	2007-04-13 01:57:12 +0000
+++ b/bzrlib/tests/test_lockable_files.py	2007-04-19 14:55:20 +0000
@@ -373,11 +373,13 @@
         # to end behaviour, so stubbing out the backend and simulating would
         # defeat the purpose. We test the protocol implementation separately
         # in test_remote and test_smart as usual.
-        self.make_branch('foo')
+        b = self.make_branch('foo')
+        self.addCleanup(b.bzrdir.transport.disconnect)
         self.transport = get_transport('.')
         self.lockable = self.get_lockable()
 
     def get_lockable(self):
         # getting a new lockable involves opening a new instance of the branch
         branch = bzrlib.branch.Branch.open(self.get_url('foo'))
+        self.addCleanup(branch.bzrdir.transport.disconnect)
         return branch.control_files

=== modified file 'bzrlib/tests/test_remote.py'
--- a/bzrlib/tests/test_remote.py	2007-04-19 04:29:20 +0000
+++ b/bzrlib/tests/test_remote.py	2007-04-19 14:55:20 +0000
@@ -54,6 +54,10 @@
         # make a branch that can be opened over the smart transport
         self.local_wt = BzrDir.create_standalone_workingtree('.')
 
+    def tearDown(self):
+        self.transport.disconnect()
+        tests.TestCaseWithTransport.tearDown(self)
+
     def test_is_readonly(self):
         # XXX: this is a poor way to test RemoteTransport, but currently there's
         # no easy way to substitute in a fake client on a transport like we can

=== modified file 'bzrlib/tests/test_smart_transport.py'
--- a/bzrlib/tests/test_smart_transport.py	2007-04-16 17:59:48 +0000
+++ b/bzrlib/tests/test_smart_transport.py	2007-04-19 14:55:20 +0000
@@ -794,6 +794,7 @@
                 self.assertContainsRe(str(e), 'some random exception')
             else:
                 self.fail("get did not raise expected error")
+            transport.disconnect()
         finally:
             smart_server.stop_background_thread()
 




More information about the bazaar-commits mailing list