Mercurial > code > home > repos > rdferry
annotate examples/serve_custom_root_page_test.py @ 12:ba73d8ba81dc default tip
refactor
author | drewp@bigasterisk.com |
---|---|
date | Mon, 18 Mar 2024 16:51:44 -0700 |
parents | 25538e3ee531 |
children |
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 | 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 | 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' |