Files
GTI_GERENCIADOR_FISCAL/fiscal/agent/tests/conftest.py
T
gti d21a9d1140 Add 'fiscal/' from commit '102ba84500dbd9655a0471288c3e278652593ca9'
git-subtree-dir: fiscal
git-subtree-mainline: d95165fc8f
git-subtree-split: 102ba84500
2026-09-29 14:43:23 -03:00

25 lines
1.0 KiB
Python

import sys
from pathlib import Path
sys.path.insert(0, str(Path(__file__).parents[1] / "src"))
import pytest
@pytest.fixture(autouse=True)
def _no_real_firebird_for_unified_fiscal(monkeypatch, request):
"""The unified fiscal assessment opens its own READ ONLY connection; unit tests have no Firebird, so it is neutral here unless a test opts in."""
if request.node.get_closest_marker("real_unified_fiscal"):
return
from gti_fiscal_agent import firebird_reader, unified_fiscal
class _Conn:
def close(self):
pass
monkeypatch.setattr(firebird_reader, "_connect", lambda env: _Conn())
monkeypatch.setattr(unified_fiscal, "assess_from_connection", lambda conn, company, **kw: {"context": {"rtc_enabled": False, "rtc_supported": False, "rtc_catalog_valid": False, "products_evaluated": 0}, "findings": {}})
def pytest_configure(config):
config.addinivalue_line("markers", "real_unified_fiscal: use the real unified fiscal assessment (with a fake cursor) instead of the neutral stub")