-
Notifications
You must be signed in to change notification settings - Fork 54
/
run-tests.py
41 lines (32 loc) · 1.05 KB
/
run-tests.py
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
import sh
import pathlib
import os
import aioftp
import inspect
for path in pathlib.Path("tests").glob("*"):
if path.is_dir():
sh.rm("-rdf", str(path))
cov = pathlib.Path(".coverage")
if cov.exists():
cov.unlink()
run_tests = sh.Command("nosetests")
for el in dir(aioftp):
item = getattr(aioftp, el)
if inspect.isclass(item) and issubclass(item, aioftp.AbstractPathIO) and \
item not in (aioftp.AbstractPathIO, aioftp.MemoryPathIO):
print(str.format("Testing {}", el))
new_env = os.environ.copy()
new_env["AIOFTP_TESTS"] = el
p = run_tests(
str.format("--exclude={}", __file__),
"--stop",
"--no-byte-compile",
"--with-coverage",
"--cover-package=aioftp",
"--logging-format='%(asctime)s %(message)s'",
"--logging-datefmt='[%H:%M:%S]:'",
"--logging-level=INFO",
_env=new_env,
_err=lambda line: print(str.strip(line)),
_out=lambda line: print(str.strip(line)),
)