File size: 864 Bytes
2695555
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
#!/usr/bin/env python3
"""Roda todos os test_*.py desta pasta, um por um, num subprocesso
(cada teste carrega o tars.py do zero, então não interferem entre si).
Uso: python3 tests/run_all.py [test_x test_y ...]   (sem nomes: todos)
"""

import subprocess
import sys
from pathlib import Path

PASTA = Path(__file__).parent

arquivos = [PASTA / (n if n.endswith(".py") else n + ".py") for n in sys.argv[1:]] or sorted(PASTA.glob("test_*.py"))

falhas = []

for arquivo in arquivos:
    print(f"\n{'=' * 60}\n{arquivo.name}\n{'=' * 60}")

    resultado = subprocess.run([sys.executable, str(arquivo)], cwd=PASTA)

    if resultado.returncode != 0:
        falhas.append(arquivo.name)

print(f"\n{'=' * 60}")

if falhas:
    print(f"FALHARAM ({len(falhas)}/{len(arquivos)}): {', '.join(falhas)}")
    sys.exit(1)

print(f"TODOS OS {len(arquivos)} TESTES PASSARAM.")