-
-
Notifications
You must be signed in to change notification settings - Fork 146
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a development server with a simple CLI
- Loading branch information
1 parent
86178d8
commit e683be0
Showing
5 changed files
with
114 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import sys | ||
from pathlib import Path | ||
|
||
import pytest | ||
from _pytest import pytester | ||
|
||
HERE = Path(__file__).absolute().parent | ||
|
||
|
||
def test_app(testdir, aiohttp_unused_port): | ||
# When the testing app is run from CMD | ||
port = aiohttp_unused_port() | ||
with pytest.raises(pytester.Testdir.TimeoutExpired): | ||
testdir.run(sys.executable, f"{HERE / 'app.py'}", str(port), timeout=0.75) | ||
with testdir.tmpdir.join("stderr").open() as fd: | ||
stderr = fd.read() | ||
# Then it should start OK and emit debug logs | ||
assert "DEBUG:asyncio:Using selector:" in stderr |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Run testing AioHTTP app on the given port | ||
PYTHONPATH=$(pwd)/src python test/app.py "$@" |