MCPcopy
hub / github.com/dask/dask / dir_server

Function dir_server

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

Source from the content-addressed store, hash-verified

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

Used in the wild real call sites across dependent graphs

searching dependent graphs…