# tests/conftest.py import pytest import toml from pathlib import Path @pytest.fixture(autouse=True) def setup_test_config(tmp_path, monkeypatch): """Autouse fixture to isolate test runs from the real config.toml.""" test_config = tmp_path / "config.toml" default_data = { "Competition": { "competition": "picoctf", "catagory": "textCat", "challenge": "testChal", "flag_format": r"picoCTF\{.*\}", "last_flag": "flag{my_flag_here}" }, "Enviroment": { "ctf_dir": "/home/venus/ctf" } } test_config.parent.mkdir(parents=True, exist_ok=True) with open(test_config, "w") as f: toml.dump(default_data, f) monkeypatch.setenv("CTF_CONFIG_PATH", str(test_config)) return test_config