MCPcopy Create free account
hub / github.com/dask/dask / dir_server

Function dir_server

dask/bytes/tests/test_http.py:29–48  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

27
28@pytest.fixture(scope="module")
29def dir_server():
30 with tmpdir() as d:
31 for fn in files:
32 with open(os.path.join(d, fn), "wb") as f:
33 f.write(b"a" * 10000)
34
35 cmd = [sys.executable, "-m", "http.server", "8999"]
36 p = subprocess.Popen(cmd, cwd=d)
37 timeout = 10
38 while True:
39 try:
40 requests.get("http://localhost:8999")
41 break
42 except requests.exceptions.ConnectionError as e:
43 time.sleep(0.1)
44 timeout -= 0.1
45 if timeout < 0:
46 raise RuntimeError("Server did not appear") from e
47 yield d
48 p.terminate()
49
50
51def test_simple(dir_server):

Callers

nothing calls this directly

Calls 3

tmpdirFunction · 0.90
joinMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected