Skip to content

Commit

Permalink
Update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Jan 6, 2025
1 parent ed4b270 commit e4cb3f8
Show file tree
Hide file tree
Showing 25 changed files with 98 additions and 11 deletions.
Binary file modified latest/.doctrees/commands/networks.doctree
Binary file not shown.
Binary file modified latest/.doctrees/environment.pickle
Binary file not shown.
Binary file modified latest/.doctrees/methoddocs/ape.doctree
Binary file not shown.
Binary file modified latest/.doctrees/methoddocs/ape_accounts.doctree
Binary file not shown.
Binary file modified latest/.doctrees/methoddocs/ape_compile.doctree
Binary file not shown.
Binary file modified latest/.doctrees/methoddocs/ape_ethereum.doctree
Binary file not shown.
Binary file modified latest/.doctrees/methoddocs/ape_node.doctree
Binary file not shown.
Binary file modified latest/.doctrees/methoddocs/ape_pm.doctree
Binary file not shown.
Binary file modified latest/.doctrees/methoddocs/ape_test.doctree
Binary file not shown.
Binary file modified latest/.doctrees/methoddocs/api.doctree
Binary file not shown.
Binary file modified latest/.doctrees/methoddocs/cli.doctree
Binary file not shown.
Binary file modified latest/.doctrees/methoddocs/contracts.doctree
Binary file not shown.
Binary file modified latest/.doctrees/methoddocs/exceptions.doctree
Binary file not shown.
Binary file modified latest/.doctrees/methoddocs/managers.doctree
Binary file not shown.
Binary file modified latest/.doctrees/methoddocs/plugins.doctree
Binary file not shown.
Binary file modified latest/.doctrees/methoddocs/types.doctree
Binary file not shown.
Binary file modified latest/.doctrees/methoddocs/utils.doctree
Binary file not shown.
Binary file modified latest/.doctrees/userguides/testing.doctree
Binary file not shown.
14 changes: 13 additions & 1 deletion latest/_sources/userguides/testing.md.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions latest/commands/networks.html
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ <h2>list<a class="headerlink" href="#networks-list" title="Link to this heading"
<dd><p>Filter the results by ecosystem</p>
<dl class="field-list simple">
<dt class="field-odd">Options<span class="colon">:</span></dt>
<dd class="field-odd"><p>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</p>
<dd class="field-odd"><p>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</p>
</dd>
</dl>
</dd></dl>
Expand All @@ -204,7 +204,7 @@ <h2>list<a class="headerlink" href="#networks-list" title="Link to this heading"
<dd><p>Filter the results by network</p>
<dl class="field-list simple">
<dt class="field-odd">Options<span class="colon">:</span></dt>
<dd class="field-odd"><p>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</p>
<dd class="field-odd"><p>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</p>
</dd>
</dl>
</dd></dl>
Expand All @@ -215,7 +215,7 @@ <h2>list<a class="headerlink" href="#networks-list" title="Link to this heading"
<dd><p>Filter the results by provider</p>
<dl class="field-list simple">
<dt class="field-odd">Options<span class="colon">:</span></dt>
<dd class="field-odd"><p>test | node</p>
<dd class="field-odd"><p>node | test</p>
</dd>
</dl>
</dd></dl>
Expand Down
22 changes: 18 additions & 4 deletions latest/genindex.html
Original file line number Diff line number Diff line change
Expand Up @@ -2219,8 +2219,18 @@ <h2 id="E">E</h2>
<li><a href="methoddocs/plugins.html#ape.plugins.network.EcosystemPlugin.ecosystems">ecosystems() (ape.plugins.network.EcosystemPlugin method)</a>
</li>
<li><a href="methoddocs/api.html#ape.api.networks.ProviderContextManager.empty">empty (ape.api.networks.ProviderContextManager property)</a>
</li>
<li><a href="methoddocs/ape_test.html#ape_test.config.IsolationConfig.enable_class">enable_class (ape_test.config.IsolationConfig attribute)</a>
</li>
<li><a href="methoddocs/ape_test.html#ape_test.config.ApeTestConfig.enable_fixture_rebasing">enable_fixture_rebasing (ape_test.config.ApeTestConfig attribute)</a>
</li>
<li><a href="methoddocs/ape_test.html#ape_test.config.IsolationConfig.enable_function">enable_function (ape_test.config.IsolationConfig attribute)</a>
</li>
<li><a href="methoddocs/ape_test.html#ape_test.config.IsolationConfig.enable_module">enable_module (ape_test.config.IsolationConfig attribute)</a>
</li>
<li><a href="methoddocs/ape_test.html#ape_test.config.IsolationConfig.enable_package">enable_package (ape_test.config.IsolationConfig attribute)</a>
</li>
<li><a href="methoddocs/ape_test.html#ape_test.config.IsolationConfig.enable_session">enable_session (ape_test.config.IsolationConfig attribute)</a>
</li>
<li><a href="methoddocs/api.html#ape.api.networks.EcosystemAPI.encode_address">encode_address() (ape.api.networks.EcosystemAPI class method)</a>

Expand Down Expand Up @@ -2282,14 +2292,14 @@ <h2 id="E">E</h2>
<li><a href="methoddocs/ape_test.html#ape_test.provider.LocalProvider.estimate_gas_cost">(ape_test.provider.LocalProvider method)</a>
</li>
</ul></li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="methoddocs/api.html#ape.api.query.QueryAPI.estimate_query">estimate_query() (ape.api.query.QueryAPI method)</a>

<ul>
<li><a href="methoddocs/managers.html#ape.managers.query.DefaultQueryProvider.estimate_query">(ape.managers.query.DefaultQueryProvider method)</a>
</li>
</ul></li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="methoddocs/ape_node.html#ape_node.provider.EthereumNodeConfig.ethereum">ethereum (ape_node.provider.EthereumNodeConfig attribute)</a>
</li>
<li><a href="methoddocs/ape_ethereum.html#ape_ethereum.ecosystem.Ethereum">Ethereum (class in ape_ethereum.ecosystem)</a>
Expand Down Expand Up @@ -2916,10 +2926,10 @@ <h2 id="I">I</h2>
</li>
<li><a href="methoddocs/api.html#ape.api.networks.NetworkAPI.is_adhoc">is_adhoc (ape.api.networks.NetworkAPI property)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="methoddocs/utils.html#ape.utils.abi.is_array">is_array() (in module ape.utils.abi)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="methoddocs/managers.html#ape.managers.project.Project.is_compiled">is_compiled (ape.managers.project.Project property)</a>
</li>
<li><a href="methoddocs/api.html#ape.api.providers.ProviderAPI.is_connected">is_connected (ape.api.providers.ProviderAPI property)</a>
Expand Down Expand Up @@ -3002,6 +3012,10 @@ <h2 id="I">I</h2>
<li><a href="methoddocs/managers.html#ape.managers.project.Project.isolate_in_tempdir">(ape.managers.project.Project method)</a>
</li>
</ul></li>
<li><a href="methoddocs/ape_test.html#ape_test.config.ApeTestConfig.isolation">isolation (ape_test.config.ApeTestConfig attribute)</a>
</li>
<li><a href="methoddocs/ape_test.html#ape_test.config.IsolationConfig">IsolationConfig (class in ape_test.config)</a>
</li>
<li><a href="methoddocs/utils.html#ape.utils.abi.Struct.items">items() (ape.utils.abi.Struct method)</a>
</li>
</ul></td>
Expand Down
53 changes: 52 additions & 1 deletion latest/methoddocs/ape_test.html

Large diffs are not rendered by default.

Binary file modified latest/objects.inv
Binary file not shown.
2 changes: 1 addition & 1 deletion latest/searchindex.js

Large diffs are not rendered by default.

12 changes: 11 additions & 1 deletion latest/userguides/testing.html
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ <h2>Isolation<a class="headerlink" href="#isolation" title="Link to this heading
After each test completes, the chain reverts to that snapshot from the beginning of the test.</p>
<p>By default, every <code class="docutils literal notranslate"><span class="pre">pytest</span></code> fixture is <code class="docutils literal notranslate"><span class="pre">function</span></code> 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 <code class="docutils literal notranslate"><span class="pre">&quot;session&quot;</span></code>, <code class="docutils literal notranslate"><span class="pre">&quot;package&quot;</span></code>, <code class="docutils literal notranslate"><span class="pre">&quot;module&quot;</span></code>, or <code class="docutils literal notranslate"><span class="pre">&quot;class&quot;</span></code>, and you <strong>must</strong> use these fixtures right away, either via <code class="docutils literal notranslate"><span class="pre">autouse=True</span></code> or using them in the first collected tests.
To only deploy once, you can use different scopes, such as <code class="docutils literal notranslate"><span class="pre">&quot;session&quot;</span></code>, <code class="docutils literal notranslate"><span class="pre">&quot;package&quot;</span></code>, <code class="docutils literal notranslate"><span class="pre">&quot;module&quot;</span></code>, or <code class="docutils literal notranslate"><span class="pre">&quot;class&quot;</span></code>, and you <strong>should</strong> use these fixtures right away, either via <code class="docutils literal notranslate"><span class="pre">autouse=True</span></code> 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.</p>
Expand Down Expand Up @@ -437,6 +437,16 @@ <h2>Isolation<a class="headerlink" href="#isolation" title="Link to this heading
</span><span data-line="6"> <span class="k">return</span> <span class="n">tokens</span><span class="p">[</span><span class="n">request</span><span class="p">]</span><span class="o">.</span><span class="n">address</span>
</span></pre></div>
</div>
<p>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.</p>
<div class="highlight-toml notranslate"><div class="highlight"><pre><span></span><span data-line="1"><span class="k">[tool.ape.test.isolation]</span>
</span><span data-line="2"><span class="n">enable_session</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="kc">false</span>
</span><span data-line="3"><span class="n">enable_package</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="kc">false</span>
</span><span data-line="4"><span class="n">enable_module</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="kc">false</span>
</span><span data-line="5"><span class="n">enable_class</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="kc">false</span>
</span></pre></div>
</div>
</section>
<section id="ape-testing-commands">
<h2>Ape testing commands<a class="headerlink" href="#ape-testing-commands" title="Link to this heading"></a></h2>
Expand Down

0 comments on commit e4cb3f8

Please sign in to comment.