"""The toolchain contract for every later test in this repo (plan Step 2). Three things have to hold before anything else is worth running, and each has already bitten this project once: 1. The interpreter is 3.10 or newer. A GUI-spawned process on this Mac can resolve `python3` to 3.9.6, which parses the code and then fails at runtime. 2. The ingestion guard is present and pinned to exactly v1.3.0. It is the trust boundary for M3; a floating version is not a boundary. 3. pytest-socket is installed and the `network` marker is registered. The suite runs with `--disable-socket --strict-markers`, so an unregistered marker would make `-m 'not network'` an error rather than a filter -- and the offline guarantee would quietly stop being tested. This is the first test file in the repo and sets the style for the rest. """ import sys def test_interpreter_is_3_10_or_newer(): assert sys.version_info >= (3, 10), ( "the toolchain requires Python 3.10+, got %s from %s" % (sys.version.split()[0], sys.executable) ) def test_guard_is_pinned_to_1_3_0(): import llm_ingestion_guard assert llm_ingestion_guard.__version__ == "1.3.0", ( "guard must be pinned to v1.3.0, got %r -- a different tag is not a " "substitute and the source is never vendored" % (llm_ingestion_guard.__version__,) ) def test_pytest_socket_installed_and_network_marker_registered(pytestconfig): import pytest_socket # noqa: F401 -- import IS the assertion markers = pytestconfig.getini("markers") names = [m.split(":", 1)[0].split("(", 1)[0].strip() for m in markers] assert "network" in names, ( "the 'network' marker must be declared in pyproject.toml; with " "--strict-markers an undeclared marker makes -m 'not network' an " "error, not a filter. Declared markers: %r" % (names,) )