askrobots / dbbasic-object-server
Public
Runs live, versioned Python application objects on one VM, with a suite of apps: projects, notes, tasks, files and more.
test_no_syntax_warnings.py · 585 bytes · 18 lines
| 1 | """Source files must compile without SyntaxWarning (invalid escape sequences etc.).""" |
| 2 | import subprocess |
| 3 | import sys |
| 4 | import warnings |
| 5 | from pathlib import Path |
| 6 | |
| 7 | import pytest |
| 8 | |
| 9 | ROOT = Path(__file__).resolve().parent.parent |
| 10 | FILES = sorted(ROOT.glob("*.py")) + sorted((ROOT / "packages").rglob("*.py")) |
| 11 | |
| 12 | |
| 13 | @pytest.mark.parametrize("path", FILES, ids=lambda p: str(p.relative_to(ROOT))) |
| 14 | def test_compiles_without_warnings(path): |
| 15 | source = path.read_text(encoding="utf-8") |
| 16 | with warnings.catch_warnings(): |
| 17 | warnings.simplefilter("error") |
| 18 | compile(source, str(path), "exec") |