diff --git a/tests/plugins/video_gen/test_fal_plugin.py b/tests/plugins/video_gen/test_fal_plugin.py index 90a968cdb7..3688cfd980 100644 --- a/tests/plugins/video_gen/test_fal_plugin.py +++ b/tests/plugins/video_gen/test_fal_plugin.py @@ -203,7 +203,7 @@ class TestFamilyRouting: @pytest.fixture def with_fake_fal(self, monkeypatch): - """Stub fal_client.submit to capture which endpoint we hit.""" + """Stub fal_client.SyncClient(key=...).submit to capture which endpoint we hit.""" import sys import types @@ -548,7 +548,7 @@ class TestUpscalePass: @pytest.fixture def with_fake_fal(self, monkeypatch): - """Stub fal_client.submit, capturing every endpoint hit in order.""" + """Stub fal_client.SyncClient(key=...).submit, capturing every endpoint hit in order.""" import sys import types diff --git a/tests/tools/test_fal_direct_profile_key.py b/tests/tools/test_fal_direct_profile_key.py index e46c794605..3480b7192f 100644 --- a/tests/tools/test_fal_direct_profile_key.py +++ b/tests/tools/test_fal_direct_profile_key.py @@ -76,7 +76,7 @@ def test_routed_turns_sign_with_their_own_profile_key(two_profiles, monkeypatch, assert submit(module, monkeypatch) == "handle" assert signed == ["B", "A", "B"] - # One client per key, reused across turns rather than rebuilt (and leaked) per request. + # One client per profile, reused across turns rather than rebuilt (and leaked) per request. assert constructed == ["B", "A"] diff --git a/tools/fal_common.py b/tools/fal_common.py index 73bb64e614..901d265a06 100644 --- a/tools/fal_common.py +++ b/tools/fal_common.py @@ -11,9 +11,13 @@ Holds the stateless atoms that every FAL-backed tool needs: * :func:`_normalize_fal_queue_url_format`, :func:`_extract_http_status` — small helpers used by both the managed client wrapper and ``_submit_fal_request``. +* :func:`direct_fal_client` — the direct-key ``SyncClient`` for the active + profile, shared by the image tool and the video plugin. Its per-profile + cache lives here; it is keyed on the ``fal_client`` module the caller + passes in, so a test that replaces that module still gets a fresh client. -Stateful pieces (cache globals, ``_managed_fal_client*`` selectors, -``_submit_fal_request``) intentionally stay on +The managed-client stateful pieces (``_managed_fal_client*`` cache globals and +selectors, ``_submit_fal_request``) intentionally stay on :mod:`tools.image_generation_tool`. That module is the patch target for existing test suites (``tests/tools/test_image_generation.py``, ``tests/tools/test_managed_media_gateways.py``) and for the