MCPcopy Create free account
hub / github.com/apache/arrow / test_uwsgi_integration

Function test_uwsgi_integration

python/pyarrow/tests/test_fs.py:2188–2217  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2186@pytest.mark.skipif(running_on_musllinux(), reason="Leaking S3ClientFinalizer causes "
2187 "segfault on musl based systems")
2188def test_uwsgi_integration():
2189 # GH-44071: using S3FileSystem under uwsgi shouldn't lead to a crash at shutdown
2190 try:
2191 subprocess.check_call(["uwsgi", "--version"])
2192 except FileNotFoundError:
2193 pytest.skip("uwsgi not installed on this Python")
2194
2195 port = find_free_port()
2196 args = ["uwsgi", "-i", "--http", f"127.0.0.1:{port}",
2197 "--wsgi-file", os.path.join(here, "wsgi_examples.py")]
2198 proc = subprocess.Popen(args, stdin=subprocess.DEVNULL)
2199 # Try to fetch URL, it should return 200 Ok...
2200 try:
2201 url = f"http://127.0.0.1:{port}/s3/"
2202 start_time = time.time()
2203 error = None
2204 while time.time() < start_time + 5:
2205 try:
2206 with urlopen(url) as resp:
2207 assert resp.status == 200
2208 break
2209 except OSError as e:
2210 error = e
2211 time.sleep(0.1)
2212 else:
2213 pytest.fail(f"Could not fetch {url!r}: {error}")
2214 finally:
2215 proc.terminate()
2216 # ... and uwsgi should gracefully shutdown after it's been asked above
2217 assert proc.wait() == 30 # UWSGI_END_CODE = 30
2218
2219
2220def test_fsspec_filesystem_from_uri():

Callers

nothing calls this directly

Calls 4

find_free_portFunction · 0.90
timeMethod · 0.80
joinMethod · 0.45
failMethod · 0.45

Tested by

no test coverage detected