annotate examples/serve_custom_root_page_test.py @ 8:25538e3ee531

rename
author drewp@bigasterisk.com
date Sat, 16 Mar 2024 12:51:39 -0700
parents b34cd6619316
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5
b34cd6619316 new test. server has to be able to exit between tests.
drewp@bigasterisk.com
parents:
diff changeset
1 from pathlib import Path
b34cd6619316 new test. server has to be able to exit between tests.
drewp@bigasterisk.com
parents:
diff changeset
2
b34cd6619316 new test. server has to be able to exit between tests.
drewp@bigasterisk.com
parents:
diff changeset
3 import pytest
b34cd6619316 new test. server has to be able to exit between tests.
drewp@bigasterisk.com
parents:
diff changeset
4
8
drewp@bigasterisk.com
parents: 5
diff changeset
5 from examples._run_server_child import RunHttpServerChildProcess
5
b34cd6619316 new test. server has to be able to exit between tests.
drewp@bigasterisk.com
parents:
diff changeset
6
b34cd6619316 new test. server has to be able to exit between tests.
drewp@bigasterisk.com
parents:
diff changeset
7
b34cd6619316 new test. server has to be able to exit between tests.
drewp@bigasterisk.com
parents:
diff changeset
8 @pytest.mark.asyncio
b34cd6619316 new test. server has to be able to exit between tests.
drewp@bigasterisk.com
parents:
diff changeset
9 async def test_http_request_to_subprocess():
8
drewp@bigasterisk.com
parents: 5
diff changeset
10 async with RunHttpServerChildProcess(
5
b34cd6619316 new test. server has to be able to exit between tests.
drewp@bigasterisk.com
parents:
diff changeset
11 Path('examples/serve_custom_root_page.py')) as http_server:
b34cd6619316 new test. server has to be able to exit between tests.
drewp@bigasterisk.com
parents:
diff changeset
12 response = await http_server.get('http://localhost:8005/')
b34cd6619316 new test. server has to be able to exit between tests.
drewp@bigasterisk.com
parents:
diff changeset
13 assert (await response.text()) == 'hello world'