summaryrefslogtreecommitdiff
path: root/run_tests.py
diff options
context:
space:
mode:
authorRoberto Bertó <463349+robertoberto@users.noreply.github.com>2025-11-02 19:55:55 -0300
committerGitHub <noreply@github.com>2025-11-02 19:55:55 -0300
commit6ca1269b138696b69c33d2db4bcf7dd03ea4caeb (patch)
tree4c0a634730df2123ff506252cbec050de006dac8 /run_tests.py
parent1ada32975f0bb559ec7526e0dd545700dde1cb94 (diff)
parent6b4e9015744ab8c9f17a6b8e23387cd676b1d827 (diff)
downloadpyvyos-6ca1269b138696b69c33d2db4bcf7dd03ea4caeb.tar.gz
pyvyos-6ca1269b138696b69c33d2db4bcf7dd03ea4caeb.zip
Merge pull request #27 from vyos-contrib/feat/architecture-and-quality-improvements
feat: v0.4.0 - Architecture refactor, bug fixes, and quality improvem…
Diffstat (limited to 'run_tests.py')
-rw-r--r--run_tests.py64
1 files changed, 64 insertions, 0 deletions
diff --git a/run_tests.py b/run_tests.py
new file mode 100644
index 0000000..e09886e
--- /dev/null
+++ b/run_tests.py
@@ -0,0 +1,64 @@
+#!/usr/bin/env python3
+"""Script para executar todos os testes e validar a instalação."""
+
+import subprocess
+import sys
+
+
+def run_command(cmd, description):
+ """Executa um comando e mostra o resultado."""
+ print(f"\n{'='*60}")
+ print(f"{description}")
+ print(f"{'='*60}")
+ try:
+ result = subprocess.run(
+ cmd, shell=True, check=True, capture_output=True, text=True
+ )
+ print(result.stdout)
+ if result.stderr:
+ print("STDERR:", result.stderr)
+ return True
+ except subprocess.CalledProcessError as e:
+ print(f"ERRO: {e}")
+ print("STDOUT:", e.stdout)
+ print("STDERR:", e.stderr)
+ return False
+
+
+def main():
+ """Executa todos os testes."""
+ print("=== PyVyOS Test Suite ===\n")
+
+ steps = [
+ ("uv sync", "1. Sincronizando dependências"),
+ ("uv run python test_quick.py", "2. Verificação rápida de imports"),
+ ("uv run pytest tests/test_shims.py -v", "3. Testes de shims"),
+ ("uv run pytest tests/utils/ -v", "4. Testes de utils"),
+ ("uv run pytest tests/test_exceptions.py -v", "5. Testes de exceptions"),
+ (
+ "uv run pytest tests/modules/test_vy_device.py::test_shim_compatibility -v",
+ "6. Teste de compatibilidade",
+ ),
+ ("uv run pytest tests/ -v --tb=short", "7. TODOS os testes"),
+ ]
+
+ results = []
+ for cmd, desc in steps:
+ success = run_command(cmd, desc)
+ results.append((desc, success))
+ if not success:
+ print(f"\n❌ Falha em: {desc}")
+ sys.exit(1)
+
+ print(f"\n{'='*60}")
+ print("✅ TODOS OS TESTES PASSARAM!")
+ print(f"{'='*60}\n")
+
+ for desc, success in results:
+ status = "✅" if success else "❌"
+ print(f"{status} {desc}")
+
+
+if __name__ == "__main__":
+ main()
+