MCPcopy Index your code
hub / github.com/python/cpython / setUp

Method setUp

Lib/test/test_robotparser.py:387–401  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

385class BaseLocalNetworkTestCase:
386
387 def setUp(self):
388 # clear _opener global variable
389 self.addCleanup(urllib.request.urlcleanup)
390
391 self.server = HTTPServer((socket_helper.HOST, 0), self.RobotHandler)
392
393 self.t = threading.Thread(
394 name='HTTPServer serving',
395 target=self.server.serve_forever,
396 # Short poll interval to make the test finish quickly.
397 # Time between requests is short enough that we won't wake
398 # up spuriously too many times.
399 kwargs={'poll_interval':0.01})
400 self.t.daemon = True # In case this function raises.
401 self.t.start()
402
403 def tearDown(self):
404 self.server.shutdown()

Callers

nothing calls this directly

Calls 3

HTTPServerClass · 0.90
addCleanupMethod · 0.80
startMethod · 0.45

Tested by

no test coverage detected