Some checks are pending
build-images / api (push) Waiting to run
build-images / worker-gpu (push) Waiting to run
build-images / web (push) Waiting to run
codeql / Analyze (javascript-typescript) (push) Waiting to run
codeql / Analyze (python) (push) Waiting to run
perf / API hot-path micro-smoke (budgeted) (push) Waiting to run
perf / Desktop engine crates (release build check) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (comfy-workflow-schema) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (effects-core) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (eventbus-types) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (growth-analytics) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (trends-schema) (push) Waiting to run
vision2026-ci / API phase modules (ruff + pytest) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (provider-adapter-kit) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (publishing-connectors) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (render-core) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (shot-template-schema) (push) Waiting to run
vision2026-ci / Python SDK resource tests (push) Waiting to run
vision2026-ci / Desktop engine crates (test + clippy + fmt) (push) Waiting to run
vision2026-ci / Alembic upgrade + drift check (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (caption-engine) (push) Waiting to run
Paid, hosted product at menivor.com, now retired as a company project. Fresh squashed history of the cleaned working tree (secret-scanned, no .env, no customer data, no outreach logs). Built on MoneyPrinterTurbo (MIT, harry0703) — see NOTICE.
82 lines
2.4 KiB
Python
82 lines
2.4 KiB
Python
"""The pytest session is hermetic: no local .env, config.toml or exported keys.
|
|
|
|
Guards the conftest that keeps a developer machine's real ``.env`` (database,
|
|
R2, Mint, provider keys, pilot flags) and untracked ``config.toml`` from
|
|
changing test outcomes or triggering live calls.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import os
|
|
from pathlib import Path
|
|
|
|
from tests.reelforge import _session_env as session_env
|
|
|
|
REPO = Path(__file__).resolve().parents[2]
|
|
|
|
|
|
def test_dotenv_loading_is_disabled_for_the_session():
|
|
assert os.environ.get("REELFORGE_DISABLE_DOTENV") == "1"
|
|
|
|
|
|
def test_config_is_an_isolated_copy_of_the_tracked_example():
|
|
from app.config import config
|
|
|
|
config_file = Path(config.config_file)
|
|
assert config_file.name == "config.toml"
|
|
assert config_file.parent != REPO # never the developer's local config.toml
|
|
assert str(config_file) == os.environ["REELFORGE_CONFIG_FILE"]
|
|
|
|
|
|
def test_launch_and_storage_env_is_pinned():
|
|
for name, value in session_env.PINNED_ENV.items():
|
|
assert os.environ.get(name) == value, name
|
|
|
|
|
|
def test_live_endpoints_and_keys_are_not_inherited():
|
|
# Values from a local .env / .env.reelforge must never reach the tests.
|
|
for name in (
|
|
"MINT_SERVER_URL",
|
|
"MINT_API_KEY",
|
|
"DATABASE_URL",
|
|
"REELFORGE_DATABASE_URL",
|
|
"REDIS_HOST",
|
|
"REPLICATE_API_TOKEN",
|
|
"ANTHROPIC_API_KEY",
|
|
"SENTRY_DSN",
|
|
"R2_BUCKET_NAME",
|
|
"R2_S3_ENDPOINT",
|
|
):
|
|
if os.environ.get(session_env.KEEP_ENV_FLAG):
|
|
break
|
|
assert name not in os.environ, name
|
|
|
|
|
|
def test_third_party_load_dotenv_is_a_noop(tmp_path, monkeypatch):
|
|
import dotenv
|
|
|
|
(tmp_path / ".env").write_text("THIRD_PARTY_LEAK=1\n", encoding="utf-8")
|
|
monkeypatch.chdir(tmp_path)
|
|
monkeypatch.delenv("THIRD_PARTY_LEAK", raising=False)
|
|
dotenv.load_dotenv()
|
|
dotenv.load_dotenv(tmp_path / ".env")
|
|
assert "THIRD_PARTY_LEAK" not in os.environ
|
|
|
|
|
|
def test_scrub_selects_behaviour_changing_vars_only():
|
|
environ = {
|
|
"MINT_SERVER_URL": "http://mint",
|
|
"REELFORGE_LAUNCH_MODE": "internal_pilot",
|
|
"REELFORGE_BACKEND_ROOT": "/repo/apps/api",
|
|
"DATABASE_URL": "postgres://x",
|
|
"ANTHROPIC_API_KEY": "k",
|
|
"PATH": "/usr/bin",
|
|
"HOME": "/home/dev",
|
|
}
|
|
assert session_env.scrubbed_names(environ) == [
|
|
"ANTHROPIC_API_KEY",
|
|
"DATABASE_URL",
|
|
"MINT_SERVER_URL",
|
|
"REELFORGE_LAUNCH_MODE",
|
|
]
|