2
0
mirror of https://github.com/LonamiWebs/Telethon synced 2025-08-24 10:58:12 +00:00
telethon/tools/check.py

28 lines
697 B
Python
Raw Normal View History

"""
2023-09-13 20:15:49 +02:00
Check formatting, type-check and run offline tests.
"""
import subprocess
import sys
2023-09-13 20:15:49 +02:00
import tempfile
BLACK_IGNORE = r"tl/(abcs|functions|types)/\w+.py"
def run(*args: str) -> int:
return subprocess.run((sys.executable, "-m", *args)).returncode
def main() -> None:
2023-09-13 20:15:49 +02:00
with tempfile.TemporaryDirectory() as tmp_dir:
exit(
run("isort", ".", "-c", "--profile", "black", "--gitignore")
or run("black", ".", "--check", "--extend-exclude", BLACK_IGNORE)
or run("mypy", "--strict", ".")
or run("sphinx", "-nW", "client/doc", tmp_dir)
or run("pytest", ".", "-m", "not net")
)
if __name__ == "__main__":
main()