Foxray: a light error tracker for the Sentry SDKs. Runs inside Django (the admin is the UI) or on its own; SQLite or Postgres, nothing else. Not affiliated with Sentry.
danq9
0.1.2: the first PyPI release (v0.1.1 is already tagged at 05cc354, before the PyPI metadata)
58507e3
4 weeks ago
History
test_boundaries.py · 1.1 KB · 29 lines
| 1 | """The core and the standalone server are standard library only, and the |
| 2 | core never imports Django.""" |
| 3 | |
| 4 | import subprocess |
| 5 | import sys |
| 6 | from pathlib import Path |
| 7 | |
| 8 | ROOT = Path(__file__).resolve().parent.parent |
| 9 | |
| 10 | CHECK = """ |
| 11 | import sys |
| 12 | import foxray.core.ingest, foxray.core.maintenance, foxray.core.sql, foxray.core.present, foxray.core.storage |
| 13 | import foxray.standalone.web, foxray.standalone.cli |
| 14 | bad = sorted(m for m in sys.modules if m.split('.')[0] in ('django', 'psycopg', 'psycopg2', 'sentry_sdk', 'brotli')) |
| 15 | print(','.join(bad)) |
| 16 | """ |
| 17 | |
| 18 | |
| 19 | def test_core_and_standalone_import_only_the_stdlib(): |
| 20 | out = subprocess.run([sys.executable, "-c", CHECK], cwd=ROOT, capture_output=True, text=True, check=True, |
| 21 | env={"PYTHONPATH": str(ROOT), "PATH": "/usr/bin:/bin"}) |
| 22 | # brotli is optional and imported only if installed; nothing else may load |
| 23 | assert [m for m in out.stdout.strip().split(",") if m and not m.startswith("brotli")] == [] |
| 24 | |
| 25 | |
| 26 | def test_core_source_never_mentions_django(): |
| 27 | for path in (ROOT / "foxray" / "core").glob("*.py"): |
| 28 | text = path.read_text() |
| 29 | assert "import django" not in text and "from django" not in text, path |