''' Binance market lookup errors across Tractor RPC. ''' import pytest import tractor import trio from piker.brokers import MarketNotFound from piker.brokers.binance import feed as binance_feed def test_missing_venue_error_over_rpc( reg_addr: tuple[str, int|str], ) -> None: ''' Preserve Binance's missing-venue error across an actor boundary. - A market with no venue fails before exchange lookup. The parent receives the diagnostic even if Tractor cannot resolve the concrete exception in its local error registry. - Call ``get_mkt_info()`` in a child and check both the expected market format and ``RemoteActorError.boxed_type``. Direct calls cannot expose a missing IPC exception registration. ''' async def main() -> None: ''' Send the invalid market through the child's RPC endpoint. ''' async with ( tractor.open_root_actor(registry_addrs=[reg_addr]), tractor.open_nursery() as an, ): portal: tractor.Portal = await an.start_actor( 'binance_lookup', enable_modules=[binance_feed.__name__], ) with pytest.raises(tractor.RemoteActorError) as raised: await portal.run_from_ns( binance_feed.__name__, 'get_mkt_info', fqme='btcusdt.binance', ) await portal.cancel_actor() exc: tractor.RemoteActorError = raised.value assert exc.boxed_type is MarketNotFound assert 'expected-form>> btcusdt..binance' in str(exc) trio.run(main)