-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
See aio-libs/aiohttp-debugtoolbar#394 (comment) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Sviatoslav Sydorenko <sviat@redhat.com>
- Loading branch information
1 parent
7d1ada8
commit a8dbb68
Showing
9 changed files
with
90 additions
and
36 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[run] | ||
branch = True | ||
source = aiohttp, tests | ||
omit = site-packages |
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 @@ | ||
Changed importing Gunicorn to happen on-demand, decreasing import time by ~53% -- :user:`Dreamsorcerer`. |
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
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 was deleted.
Oops, something went wrong.
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,52 @@ | ||
import os | ||
import platform | ||
import sys | ||
from pathlib import Path | ||
|
||
import pytest | ||
|
||
|
||
def test___all__(pytester: pytest.Pytester) -> None: | ||
"""See https://github.com/aio-libs/aiohttp/issues/6197""" | ||
pytester.makepyfile( | ||
test_a=""" | ||
from aiohttp import * | ||
assert 'GunicornWebWorker' in globals() | ||
""" | ||
) | ||
result = pytester.runpytest("-vv") | ||
result.assert_outcomes(passed=0, errors=0) | ||
|
||
|
||
def test_web___all__(pytester: pytest.Pytester) -> None: | ||
pytester.makepyfile( | ||
test_b=""" | ||
from aiohttp.web import * | ||
""" | ||
) | ||
result = pytester.runpytest("-vv") | ||
result.assert_outcomes(passed=0, errors=0) | ||
|
||
|
||
@pytest.mark.skipif( | ||
not sys.platform.startswith("linux") or platform.python_implementation() == "PyPy", | ||
reason="Timing is more reliable on Linux", | ||
) | ||
def test_import_time(pytester: pytest.Pytester) -> None: | ||
"""Check that importing aiohttp doesn't take too long. | ||
Obviously, the time may vary on different machines and may need to be adjusted | ||
from time to time, but this should provide an early warning if something is | ||
added that significantly increases import time. | ||
""" | ||
root = Path(__file__).parent.parent | ||
old_path = os.environ.get("PYTHONPATH") | ||
os.environ["PYTHONPATH"] = os.pathsep.join([str(root)] + sys.path) | ||
r = pytester.run(sys.executable, "-We", "-c", "import aiohttp", timeout=0.41) | ||
if old_path is None: | ||
os.environ.pop("PYTHONPATH") | ||
else: | ||
os.environ["PYTHONPATH"] = old_path | ||
|
||
assert not r.stdout.str() | ||
assert not r.stderr.str() |