Skip to content

Commit 295879d

Browse files
raxhvldanceratopz
andauthored
✨ feat(gentest): use jinja2 templating in gentest (#900)
Co-authored-by: rahul <[email protected]> Co-authored-by: danceratopz <[email protected]>
1 parent 6fb195b commit 295879d

File tree

7 files changed

+370
-347
lines changed

7 files changed

+370
-347
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ tf = "cli.pytest_commands.fill:tf"
8989
checkfixtures = "cli.check_fixtures:check_fixtures"
9090
consume = "cli.pytest_commands.consume:consume"
9191
genindex = "cli.gen_index:generate_fixtures_index_cli"
92-
gentest = "cli.gentest:make_test"
92+
gentest = "cli.gentest:generate"
9393
pyspelling_soft_fail = "cli.tox_helpers:pyspelling"
9494
markdownlintcli2_soft_fail = "cli.tox_helpers:markdownlint"
9595
order_fixtures = "cli.order_fixtures:order_fixtures"

src/cli/gentest.py

Lines changed: 0 additions & 346 deletions
This file was deleted.

src/cli/gentest/__init__.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
"""
2+
Generate a Python blockchain test from a transaction hash.
3+
4+
This script can be used to generate Python source for a blockchain test case
5+
that replays a mainnet or testnet transaction from its transaction hash.
6+
7+
Requirements:
8+
9+
1. Access to an archive node for the network where the transaction
10+
originates. A provider may be used.
11+
2. The transaction hash of a type 0 transaction (currently only legacy
12+
transactions are supported).
13+
14+
Example Usage:
15+
16+
1. Generate a test for a transaction with hash
17+
18+
```console
19+
uv run gentest \
20+
0xa41f343be7a150b740e5c939fa4d89f3a2850dbe21715df96b612fc20d1906be \
21+
tests/paris/test_0xa41f.py
22+
```
23+
24+
2. Fill the test:
25+
26+
```console
27+
fill --fork=Paris tests/paris/test_0xa41f.py
28+
```
29+
30+
Limitations:
31+
32+
1. Only legacy transaction types (type 0) are currently supported.
33+
"""
34+
35+
from .cli import generate # noqa: 401

0 commit comments

Comments
 (0)