-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtesting.py
More file actions
32 lines (25 loc) · 698 Bytes
/
testing.py
File metadata and controls
32 lines (25 loc) · 698 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
"""Test utilities."""
import sys
import warnings
# Suppress unawaited coroutine warnings from AsyncMock in tests.
warnings.filterwarnings("ignore", message="coroutine.*was never awaited")
def run_tests(test_file: str) -> None:
"""Run pytest on a test file with standard flags.
Usage:
if __name__ == "__main__":
from testing import run_tests
run_tests(__file__)
"""
import pytest
sys.exit(
pytest.main(
[
test_file,
"-v",
"-s",
"-W",
"ignore::pytest.PytestAssertRewriteWarning",
*sys.argv[1:],
]
)
)