MCPcopy Create free account
hub / github.com/kurtmckee/feedparser / FeedParserTestServer

Class FeedParserTestServer

tests/runtests.py:128–144  ·  view source on GitHub ↗

HTTP Server that runs in a thread and handles a predetermined number of requests

Source from the content-addressed store, hash-verified

126
127
128class FeedParserTestServer(threading.Thread):
129 """HTTP Server that runs in a thread and handles a predetermined number of requests"""
130
131 def __init__(self, requests):
132 threading.Thread.__init__(self)
133 self.requests = requests
134 self.ready = threading.Event()
135 self.httpd = None
136
137 def run(self):
138 self.httpd = http.server.HTTPServer((_HOST, _PORT), FeedParserTestRequestHandler)
139 self.ready.set()
140 while self.requests:
141 self.httpd.handle_request()
142 self.requests -= 1
143 self.ready.clear()
144 self.httpd.shutdown()
145
146
147# ---------- dummy test case class (test methods are added dynamically) ----------

Callers 1

runtestsFunction · 0.85

Calls

no outgoing calls

Tested by 1

runtestsFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…