"""Fase 3 — GATED live Azure portfolio run (SC7 / SC9). NOT default CI: skips cleanly without a configured Foundry endpoint + deployment. When set, ``run_portfolio`` fans out over the reference portfolio on the REAL ``azure`` profile (one project, hard token-capped per D6). Mirrors ``test_foundry_profile_live.py:14-24``. SC9 is unchanged — this arm stays skipped offline. """ import os import pytest from portfolio_optimiser.run import PortfolioResult, run_portfolio _ENDPOINT = os.environ.get("PORTFOLIO_FOUNDRY_PROJECT_ENDPOINT") _DEPLOYMENT = os.environ.get("PORTFOLIO_FOUNDRY_DEPLOYMENT") _NO_FOUNDRY = not (_ENDPOINT and _DEPLOYMENT) @pytest.mark.skipif( _NO_FOUNDRY, reason="Foundry not configured (set PORTFOLIO_FOUNDRY_PROJECT_ENDPOINT + PORTFOLIO_FOUNDRY_DEPLOYMENT)", ) async def test_portfolio_live_azure_fanout() -> None: # No client_factory -> the real AZURE backend is used; hard-capped per D6. result = await run_portfolio(["FV42-GSV-E1"], "azure", max_tokens=2000) assert isinstance(result, PortfolioResult) assert len(result.runs) == 1