Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ feat(gentest): use jinja2 templating in gentest #900

Merged
merged 11 commits into from
Oct 18, 2024
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