~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/ftp_server/pyftpdlib_based.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2010-08-30 07:47:38 UTC
  • mfrom: (5394.2.1 integration2)
  • Revision ID: pqm@pqm.ubuntu.com-20100830074738-ymqwum541fi8b4sr
(vila) Fix most of the leaking tests (Vincent Ladeuil)

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
 
29
29
from bzrlib import (
30
30
    osutils,
 
31
    tests,
31
32
    trace,
32
33
    )
33
34
from bzrlib.tests import test_server
183
184
        self._ftpd_starting.acquire() # So it can be released by the server
184
185
        self._ftpd_thread = threading.Thread(target=self._run_server,)
185
186
        self._ftpd_thread.start()
 
187
        if 'threads' in tests.selftest_debug_flags:
 
188
            sys.stderr.write('Thread started: %s\n'
 
189
                             % (self._ftpd_thread.ident,))
186
190
        # Wait for the server thread to start (i.e release the lock)
187
191
        self._ftpd_starting.acquire()
188
192
        self._ftpd_starting.release()
195
199
        self._ftp_server.close()
196
200
        self._ftpd_running = False
197
201
        self._ftpd_thread.join()
 
202
        if 'threads' in tests.selftest_debug_flags:
 
203
            sys.stderr.write('Thread  joined: %s\n'
 
204
                             % (self._ftpd_thread.ident,))
198
205
 
199
206
    def _run_server(self):
200
207
        """Run the server until stop_server is called, shut it down properly then.