Skip to content
27 changes: 27 additions & 0 deletions Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ test-tests *args:
-n {{ xdist_workers }} \
--basetemp="{{ output_dir }}/test-tests/tmp" \
--ignore=src/execution_testing/cli/pytest_commands/plugins/filler/tests/test_benchmarking.py \
--ignore=src/execution_testing/cli/pytest_commands/plugins/filler/tests/test_gas_taint_e2e.py \
"$@" \
src

Expand All @@ -192,6 +193,7 @@ test-tests-pypy *args:
-n auto --maxprocesses 6 \
--basetemp="{{ output_dir }}/test-tests-pypy/tmp" \
--ignore=src/execution_testing/cli/pytest_commands/plugins/filler/tests/test_benchmarking.py \
--ignore=src/execution_testing/cli/pytest_commands/plugins/filler/tests/test_gas_taint_e2e.py \
"$@" \
src

Expand All @@ -205,6 +207,31 @@ test-tests-bench *args:
"$@" \
packages/testing/src/execution_testing/cli/pytest_commands/plugins/filler/tests/test_benchmarking.py

# Scan tests for gas assertions and apply @pytest.mark.gas_check to them
[group('gas check')]
mark_gas_tests *args:
@mkdir -p "{{ output_dir }}/mark-gas-tests/tmp"
uv run fill \
--detect-gas-checks \
--gas-check-report="{{ output_dir }}/mark-gas-tests/gas_check_report.json" \
-m "not slow" \
-n {{ xdist_workers }} --dist=loadgroup \
--clean \
--skip-index \
--output="{{ output_dir }}/mark-gas-tests/fixtures" \
"$@"
uv run python scripts/mark_tests.py \
"{{ output_dir }}/mark-gas-tests/gas_check_report.json"

# Run the gas_taint plugin end-to-end (pytester) tests
[group('gas check')]
mark_gas_tests_test *args:
@mkdir -p "{{ output_dir }}/mark-gas-tests-test/tmp"
uv run pytest \
--basetemp="{{ output_dir }}/mark-gas-tests-test/tmp" \
"$@" \
packages/testing/src/execution_testing/cli/pytest_commands/plugins/filler/tests/test_gas_taint_e2e.py

# Run CI release script integration tests
[group('unit tests')]
test-ci-scripts *args:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1700,6 +1700,18 @@ def __init__(self, *args: Any, **kwargs: Any) -> None:

super(BaseTestWrapper, self).__init__(*args, **kwargs)

if getattr(request.config, "_gas_taint_enabled", False):
from .gas_taint import collect_taint_hits

hits = collect_taint_hits(self, request.node)
if hits:
request.config._gas_taint_results[ # type: ignore[attr-defined]
request.node.nodeid
] = hits
request.node.user_properties.append(
("gas_taint_hits", hits)
)

# Get the filling session from config
session: FillingSession = request.config.filling_session # type: ignore
assert isinstance(session, FillingSession)
Expand Down
Loading
Loading