/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/http_server.py

  • Committer: Ian Clatworthy
  • Date: 2008-12-15 06:18:29 UTC
  • mfrom: (3905 +trunk)
  • mto: (3586.1.23 views-ui)
  • mto: This revision was merged to the branch mainline in revision 4030.
  • Revision ID: ian.clatworthy@canonical.com-20081215061829-c8qwa93g71u9fsh5
merge bzr.dev 3905

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
import posixpath
21
21
import random
22
22
import re
 
23
import select
23
24
import SimpleHTTPServer
24
25
import socket
25
26
import SocketServer
346
347
             # WSAENOTCONN (10057) 'Socket is not connected' is harmless on
347
348
             # windows (occurs before the first connection attempt
348
349
             # vila--20071230)
349
 
             if not len(e.args) or e.args[0] != 10057:
 
350
 
 
351
             # 'Socket is not connected' can also occur on OSX, with a
 
352
             # "regular" ENOTCONN (when something went wrong during test case
 
353
             # setup leading to self.setUp() *not* being called but
 
354
             # self.tearDown() still being called -- vila20081106
 
355
             if not len(e.args) or e.args[0] not in (errno.ENOTCONN, 10057):
350
356
                 raise
351
357
         # Let the server properly close the socket
352
358
         self.server_close()
418
424
        # Allows tests to verify number of GET requests issued
419
425
        self.GET_request_nb = 0
420
426
 
 
427
    def __repr__(self):
 
428
        return "%s(%s:%s)" % \
 
429
            (self.__class__.__name__, self.host, self.port)
 
430
 
421
431
    def _get_httpd(self):
422
432
        if self._httpd is None:
423
433
            rhandler = self.request_handler
467
477
                httpd.handle_request()
468
478
            except socket.timeout:
469
479
                pass
 
480
            except (socket.error, select.error), e:
 
481
               if e[0] == errno.EBADF:
 
482
                   # Starting with python-2.6, handle_request may raise socket
 
483
                   # or select exceptions when the server is shut down (as we
 
484
                   # do).
 
485
                   pass
 
486
               else:
 
487
                   raise
470
488
 
471
489
    def _get_remote_url(self, path):
472
490
        path_parts = path.split(os.path.sep)