-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.py
More file actions
64 lines (49 loc) · 1.57 KB
/
Copy pathtest.py
File metadata and controls
64 lines (49 loc) · 1.57 KB
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import sys
from argparse import ArgumentParser
from os import environ
from subprocess import CalledProcessError, run
from aiotimer.utility.boolean import parse_boolean
def main() -> None:
"""Perform thorough quality assurance of the library code."""
parser = ArgumentParser()
parser.add_argument('--skip-slow', type=parse_boolean)
arguments = parser.parse_args()
marks = ''
if arguments.skip_slow:
marks = '(not slow)'
environment = {
**environ,
'CLICOLOR': '1',
'CLICOLOR_FORCE': '1',
'FORCE_COLOR': '1',
}
sources = [
'examples',
'sources',
'tests',
'test.py',
]
path = '.tools'
commands = [
['ruff', f'--config={path}/ruff.toml', 'check', *sources],
['flake8', f'--config={path}/flake8.ini', *sources],
['pyright', f'--project={path}/pyright.json', *sources],
['mypy', f'--config-file={path}/mypy.ini', *sources],
['ty', 'check', f'--config-file={path}/ty.toml', *sources],
['pylint', f'--rcfile={path}/pylint.ini', *sources],
['pyrefly', 'check', f'--config={path}/pyrefly.toml'],
['pytest', f'--config-file={path}/pytest.ini', f'-m={marks}', 'tests'],
]
success = True
for command in commands:
command_text = ' '.join(command)
print(command_text)
try:
run(command, check=True, env=environment)
except CalledProcessError:
success = False
print()
if not success:
sys.exit(1)
if __name__ == '__main__':
main()