askrobots / foxray Public

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.

0 downloads

foxray/tests/test_boundaries.py
Download zip
Clone
Clone with git
git clone https://gitstable.com/git/askrobots/foxray.git
HTTPS
https://gitstable.com/git/askrobots/foxray.git
SSH
ssh://git@gitstable.com:2222/askrobots/foxray.git

Cloning needs no sign-in. Pushing over HTTPS asks for your username and an access token. SSH needs your key under SSH keys.

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
2core never imports Django."""
3
4import subprocess
5import sys
6from pathlib import Path
7
8ROOT = Path(__file__).resolve().parent.parent
9
10CHECK = """
11import sys
12import foxray.core.ingest, foxray.core.maintenance, foxray.core.sql, foxray.core.present, foxray.core.storage
13import foxray.standalone.web, foxray.standalone.cli
14bad = sorted(m for m in sys.modules if m.split('.')[0] in ('django', 'psycopg', 'psycopg2', 'sentry_sdk', 'brotli'))
15print(','.join(bad))
16"""
17
18
19def 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
26def 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