install_token_cache

Documentation for eth_defi.testing.token_cache.install_token_cache function.

install_token_cache(worker_id='master')

Install the shipped token cache as the default for vaults in this session.

Copies TOKEN_CACHE_SEED_PATH to a private per-worker working file (so concurrent pytest-xdist workers never contend on one SQLite file and the committed seed is never mutated in place), opens it as a TokenDiskCache, and points eth_defi.vault.base.DEFAULT_TOKEN_CACHE at it. Every vault constructed without an explicit token_cache then uses the disk cache, which is what enables the address-resolution cache as well as the metadata cache.

Parameters

worker_id (str) – pytest-xdist worker id, used to keep working files separate.

Returns

The installed cache. When no seed is committed yet this is an empty cache, so a rebuild run can still fill it.

Return type

eth_defi.token.TokenDiskCache