diff --git a/latest/.doctrees/commands/networks.doctree b/latest/.doctrees/commands/networks.doctree index 5519cceac6..22e1a4bbce 100644 Binary files a/latest/.doctrees/commands/networks.doctree and b/latest/.doctrees/commands/networks.doctree differ diff --git a/latest/.doctrees/environment.pickle b/latest/.doctrees/environment.pickle index dfdfaaba22..3204a98316 100644 Binary files a/latest/.doctrees/environment.pickle and b/latest/.doctrees/environment.pickle differ diff --git a/latest/.doctrees/methoddocs/ape.doctree b/latest/.doctrees/methoddocs/ape.doctree index 4db76ebbd6..4b0b7bb6dc 100644 Binary files a/latest/.doctrees/methoddocs/ape.doctree and b/latest/.doctrees/methoddocs/ape.doctree differ diff --git a/latest/.doctrees/methoddocs/ape_accounts.doctree b/latest/.doctrees/methoddocs/ape_accounts.doctree index f969f01fe1..35ee59a2f5 100644 Binary files a/latest/.doctrees/methoddocs/ape_accounts.doctree and b/latest/.doctrees/methoddocs/ape_accounts.doctree differ diff --git a/latest/.doctrees/methoddocs/ape_compile.doctree b/latest/.doctrees/methoddocs/ape_compile.doctree index 93448cc742..cfe8e0ee17 100644 Binary files a/latest/.doctrees/methoddocs/ape_compile.doctree and b/latest/.doctrees/methoddocs/ape_compile.doctree differ diff --git a/latest/.doctrees/methoddocs/ape_ethereum.doctree b/latest/.doctrees/methoddocs/ape_ethereum.doctree index f95e0c71c1..acd0cf670d 100644 Binary files a/latest/.doctrees/methoddocs/ape_ethereum.doctree and b/latest/.doctrees/methoddocs/ape_ethereum.doctree differ diff --git a/latest/.doctrees/methoddocs/ape_node.doctree b/latest/.doctrees/methoddocs/ape_node.doctree index 77aac690fe..8a07587fc7 100644 Binary files a/latest/.doctrees/methoddocs/ape_node.doctree and b/latest/.doctrees/methoddocs/ape_node.doctree differ diff --git a/latest/.doctrees/methoddocs/ape_pm.doctree b/latest/.doctrees/methoddocs/ape_pm.doctree index 164f3a71ed..965afe6c92 100644 Binary files a/latest/.doctrees/methoddocs/ape_pm.doctree and b/latest/.doctrees/methoddocs/ape_pm.doctree differ diff --git a/latest/.doctrees/methoddocs/ape_test.doctree b/latest/.doctrees/methoddocs/ape_test.doctree index acc2356939..f5f3328028 100644 Binary files a/latest/.doctrees/methoddocs/ape_test.doctree and b/latest/.doctrees/methoddocs/ape_test.doctree differ diff --git a/latest/.doctrees/methoddocs/api.doctree b/latest/.doctrees/methoddocs/api.doctree index 150e59efae..af6f1bbaf3 100644 Binary files a/latest/.doctrees/methoddocs/api.doctree and b/latest/.doctrees/methoddocs/api.doctree differ diff --git a/latest/.doctrees/methoddocs/cli.doctree b/latest/.doctrees/methoddocs/cli.doctree index 17e0c897bc..3487b8a4c2 100644 Binary files a/latest/.doctrees/methoddocs/cli.doctree and b/latest/.doctrees/methoddocs/cli.doctree differ diff --git a/latest/.doctrees/methoddocs/contracts.doctree b/latest/.doctrees/methoddocs/contracts.doctree index 0e1f58a749..718ab48608 100644 Binary files a/latest/.doctrees/methoddocs/contracts.doctree and b/latest/.doctrees/methoddocs/contracts.doctree differ diff --git a/latest/.doctrees/methoddocs/exceptions.doctree b/latest/.doctrees/methoddocs/exceptions.doctree index 979db003a4..f4f3f8d0e4 100644 Binary files a/latest/.doctrees/methoddocs/exceptions.doctree and b/latest/.doctrees/methoddocs/exceptions.doctree differ diff --git a/latest/.doctrees/methoddocs/managers.doctree b/latest/.doctrees/methoddocs/managers.doctree index 1602e15763..1d66741ecd 100644 Binary files a/latest/.doctrees/methoddocs/managers.doctree and b/latest/.doctrees/methoddocs/managers.doctree differ diff --git a/latest/.doctrees/methoddocs/plugins.doctree b/latest/.doctrees/methoddocs/plugins.doctree index 7351cc5f2d..bfd8c164b3 100644 Binary files a/latest/.doctrees/methoddocs/plugins.doctree and b/latest/.doctrees/methoddocs/plugins.doctree differ diff --git a/latest/.doctrees/methoddocs/types.doctree b/latest/.doctrees/methoddocs/types.doctree index 75969ce103..074734e400 100644 Binary files a/latest/.doctrees/methoddocs/types.doctree and b/latest/.doctrees/methoddocs/types.doctree differ diff --git a/latest/.doctrees/methoddocs/utils.doctree b/latest/.doctrees/methoddocs/utils.doctree index 6e3d408b85..47c99b7260 100644 Binary files a/latest/.doctrees/methoddocs/utils.doctree and b/latest/.doctrees/methoddocs/utils.doctree differ diff --git a/latest/.doctrees/userguides/testing.doctree b/latest/.doctrees/userguides/testing.doctree index 80ba647aed..963e2452de 100644 Binary files a/latest/.doctrees/userguides/testing.doctree and b/latest/.doctrees/userguides/testing.doctree differ diff --git a/latest/_sources/userguides/testing.md.txt b/latest/_sources/userguides/testing.md.txt index 81e7e9c198..2be9404b5a 100644 --- a/latest/_sources/userguides/testing.md.txt +++ b/latest/_sources/userguides/testing.md.txt @@ -227,7 +227,7 @@ After each test completes, the chain reverts to that snapshot from the beginning By default, every `pytest` fixture is `function` scoped, meaning it will be replayed each time it is requested (no result-caching). For example, if you deploy a contract in a function-scoped fixture, it will be re-deployed each time the fixture gets used in your tests. -To only deploy once, you can use different scopes, such as `"session"`, `"package"`, `"module"`, or `"class"`, and you **must** use these fixtures right away, either via `autouse=True` or using them in the first collected tests. +To only deploy once, you can use different scopes, such as `"session"`, `"package"`, `"module"`, or `"class"`, and you **should** use these fixtures right away, either via `autouse=True` or using them in the first collected tests. Otherwise, higher-scoped fixtures that arrive late in a Pytest session will cause the snapshotting system to have to rebase itself, which can be costly. For example, if you define a session scoped fixture that deploys a contract and makes transactions, the state changes from those transactions remain in subsequent tests, whether those tests use that fixture or not. However, if a new fixture of a session scope comes into play after module, package, or class scoped snapshots have already been taken, those lower-scoped fixtures are now invalid and have to re-run after the session fixture to ensure the session fixture remains in the session-snapshot. @@ -285,6 +285,18 @@ def token_addresses(request): return tokens[request].address ``` +You can also disable isolation for individual scopes using Ape's config. +For example, the below config will disable isolation across all high-level scopes but maintain isolation for the function-scope. +This is useful if you want your individual tests to be isolated but not any session/module scoped fixtures. + +```toml +[tool.ape.test.isolation] +enable_session = false +enable_package = false +enable_module = false +enable_class = false +``` + ## Ape testing commands ```bash diff --git a/latest/commands/networks.html b/latest/commands/networks.html index 4c30f6701e..3d737ec5ac 100644 --- a/latest/commands/networks.html +++ b/latest/commands/networks.html @@ -193,7 +193,7 @@
Filter the results by ecosystem
avalanche | arbitrum | polynomial | polygon | blast | zetachain | fantom | unichain | taiko | berachain | abstract | shibarium | lens | celo | scroll | base | bttc | moonbeam | flow-evm | gnosis | palm | soneium | xmtp | crossfi | shape | kroma | metis | zksync | xai | wemix | lumia | world-chain | apechain | linea | cronos-zkevm | cronos | bsc | fraxtal | oort | geist | rootstock | mantle | ethereum | zora | optimism | polygon-zkevm | astar
+xmtp | linea | zksync | kroma | optimism | arbitrum | lumia | xai | rootstock | astar | ethereum | unichain | polynomial | shibarium | zetachain | oort | fantom | scroll | cronos-zkevm | base | world-chain | moonbeam | fraxtal | palm | lens | bttc | flow-evm | zora | polygon | metis | soneium | blast | berachain | crossfi | polygon-zkevm | wemix | shape | apechain | cronos | taiko | gnosis | celo | avalanche | geist | bsc | mantle | abstract
Filter the results by network
opbnb | cardona | nova-fork | mumbai-fork | moonbase-fork | mainnet | mainnet-fork | amoy-fork | donau-fork | alfajores-fork | opbnb-testnet | polter | hekla | hekla-fork | cardona-fork | testnet | moonriver-fork | curtis | sepolia-fork | goerli-fork | fuji-fork | bartio-fork | bartio | curtis-fork | opbnb-testnet-fork | nova | moonriver | goerli | prism-fork | chiado-fork | puppynet | dev | minato | donau | dev-fork | amoy | polter-fork | chiado | mumbai | sepolia | minato-fork | alfajores | moonbase | testnet-fork | prism | holesky-fork | puppynet-fork | local | opbnb-fork | fuji | holesky
+prism-fork | moonriver | opbnb | puppynet-fork | bartio-fork | cardona | curtis | fuji | fuji-fork | hekla-fork | alfajores-fork | mumbai | curtis-fork | alfajores | holesky-fork | dev | mumbai-fork | hekla | goerli-fork | dev-fork | puppynet | goerli | testnet-fork | donau | moonbase-fork | minato-fork | polter-fork | mainnet-fork | chiado | bartio | amoy-fork | opbnb-fork | local | polter | prism | testnet | chiado-fork | sepolia | mainnet | nova | sepolia-fork | moonriver-fork | cardona-fork | nova-fork | amoy | holesky | donau-fork | moonbase | minato | opbnb-testnet-fork | opbnb-testnet
Filter the results by provider
test | node
+node | test
enable_fixture_rebasing
gas
hd_path
isolation
mnemonic
number_of_accounts
provider
GasExclusion
IsolationConfig
+ApeEVMBackend
EthTesterTransactionTrace
return_value
The hd_path to use when generating the test accounts.
Configure which scope-specific isolation to enable. Set to
+False
to disable all and True
(default) to disable all.
Set to False
to disable class isolation.
Set to False
to disable function isolation.
Set to False
to disable module isolation.
Set to False
to disable package isolation.
Set to False
to disable session isolation.
function
scoped, meaning it will be replayed each time it is requested (no result-caching).
For example, if you deploy a contract in a function-scoped fixture, it will be re-deployed each time the fixture gets used in your tests.
-To only deploy once, you can use different scopes, such as "session"
, "package"
, "module"
, or "class"
, and you must use these fixtures right away, either via autouse=True
or using them in the first collected tests.
+To only deploy once, you can use different scopes, such as "session"
, "package"
, "module"
, or "class"
, and you should use these fixtures right away, either via autouse=True
or using them in the first collected tests.
Otherwise, higher-scoped fixtures that arrive late in a Pytest session will cause the snapshotting system to have to rebase itself, which can be costly.
For example, if you define a session scoped fixture that deploys a contract and makes transactions, the state changes from those transactions remain in subsequent tests, whether those tests use that fixture or not.
However, if a new fixture of a session scope comes into play after module, package, or class scoped snapshots have already been taken, those lower-scoped fixtures are now invalid and have to re-run after the session fixture to ensure the session fixture remains in the session-snapshot.
@@ -437,6 +437,16 @@ You can also disable isolation for individual scopes using Ape’s config. +For example, the below config will disable isolation across all high-level scopes but maintain isolation for the function-scope. +This is useful if you want your individual tests to be isolated but not any session/module scoped fixtures.
+[tool.ape.test.isolation]
+enable_session = false
+enable_package = false
+enable_module = false
+enable_class = false
+