-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
376 additions
and
154 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 |
---|---|---|
|
@@ -64,3 +64,8 @@ target/ | |
|
||
# OS X | ||
.DS_Store | ||
/.vscode | ||
/.pytest_cache | ||
/.pyre | ||
/.mypy_cache | ||
/type_info.json |
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,30 @@ | ||
# Configuration for pytest to automatically collect types. | ||
# Thanks to Guilherme Salgado. | ||
import pytest | ||
|
||
try: | ||
import pyannotate_runtime | ||
PYANOTATE_PRESENT = True | ||
except ImportError: | ||
PYANOTATE_PRESENT = False | ||
|
||
if PYANOTATE_PRESENT: | ||
def pytest_collection_finish(session): | ||
"""Handle the pytest collection finish hook: configure pyannotate. | ||
Explicitly delay importing `collect_types` until all tests have | ||
been collected. This gives gevent a chance to monkey patch the | ||
world before importing pyannotate. | ||
""" | ||
from pyannotate_runtime import collect_types | ||
collect_types.init_types_collection() | ||
|
||
@pytest.fixture(autouse=True) | ||
def collect_types_fixture(): | ||
from pyannotate_runtime import collect_types | ||
collect_types.resume() | ||
yield | ||
collect_types.pause() | ||
|
||
def pytest_sessionfinish(session, exitstatus): | ||
from pyannotate_runtime import collect_types | ||
collect_types.dump_stats("type_info.json") |
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
Oops, something went wrong.