]> git.scottworley.com Git - paperdoorknob/blobdiff - fetch_test.py
Move per-thread processing stuff into Thread
[paperdoorknob] / fetch_test.py
index 5f21feee1c2d293e198d12a5851c38a1e52524ab..59a1514853d3f370fe233b2a883c5f8ad196ad88 100644 (file)
@@ -45,7 +45,10 @@ class TestFetch(unittest.TestCase):
 
     def testCacheHitRateReport(self) -> None:
         buf = StringIO()
 
     def testCacheHitRateReport(self) -> None:
         buf = StringIO()
-        with CachingFetcher("testcachehitratereportwithcl", TIMEOUT, buf) as f:
+
+        def log(msg: str) -> None:
+            print(msg, file=buf)
+        with CachingFetcher("testcachehitratereportwithcl", TIMEOUT, log) as f:
             for _ in range(7):
                 f.fetch(f"http://localhost:{self._port}")
         self.assertEqual("Fetch cache hits: 6 (85.7%)\n", buf.getvalue())
             for _ in range(7):
                 f.fetch(f"http://localhost:{self._port}")
         self.assertEqual("Fetch cache hits: 6 (85.7%)\n", buf.getvalue())