Skip to content

Commit

Permalink
✨ feat(gentest): use jinja2 templating in gentest (#900)
Browse files Browse the repository at this point in the history
Co-authored-by: rahul <[email protected]>
Co-authored-by: danceratopz <[email protected]>
  • Loading branch information
3 people authored Oct 18, 2024
1 parent 6fb195b commit 295879d
Show file tree
Hide file tree
Showing 7 changed files with 370 additions and 347 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ tf = "cli.pytest_commands.fill:tf"
checkfixtures = "cli.check_fixtures:check_fixtures"
consume = "cli.pytest_commands.consume:consume"
genindex = "cli.gen_index:generate_fixtures_index_cli"
gentest = "cli.gentest:make_test"
gentest = "cli.gentest:generate"
pyspelling_soft_fail = "cli.tox_helpers:pyspelling"
markdownlintcli2_soft_fail = "cli.tox_helpers:markdownlint"
order_fixtures = "cli.order_fixtures:order_fixtures"
Expand Down
346 changes: 0 additions & 346 deletions src/cli/gentest.py

This file was deleted.

35 changes: 35 additions & 0 deletions src/cli/gentest/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
"""
Generate a Python blockchain test from a transaction hash.
This script can be used to generate Python source for a blockchain test case
that replays a mainnet or testnet transaction from its transaction hash.
Requirements:
1. Access to an archive node for the network where the transaction
originates. A provider may be used.
2. The transaction hash of a type 0 transaction (currently only legacy
transactions are supported).
Example Usage:
1. Generate a test for a transaction with hash
```console
uv run gentest \
0xa41f343be7a150b740e5c939fa4d89f3a2850dbe21715df96b612fc20d1906be \
tests/paris/test_0xa41f.py
```
2. Fill the test:
```console
fill --fork=Paris tests/paris/test_0xa41f.py
```
Limitations:
1. Only legacy transaction types (type 0) are currently supported.
"""

from .cli import generate # noqa: 401
Loading

0 comments on commit 295879d

Please sign in to comment.