From be8bb6685bc60d74bb0e811152315af6d3217128 Mon Sep 17 00:00:00 2001 From: danceratopz Date: Tue, 27 Jun 2023 14:50:26 +0200 Subject: [PATCH] pytest: compile Yul with --target-version shanghai when fork is cancun --- tests/conftest.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 tests/conftest.py diff --git a/tests/conftest.py b/tests/conftest.py new file mode 100644 index 0000000000..de80ed2829 --- /dev/null +++ b/tests/conftest.py @@ -0,0 +1,20 @@ +""" +Pytest (plugin) definitions local to Cancun tests. +""" +import warnings + +import pytest + + +def pytest_collection_modifyitems(items): + """ + Modify tests post collection. + + Here we override the default behavior of the `yul` fixture so that + solc compiles with shanghai instead of cancun (which is unavailable + in solc 0.8.20). + """ + for item in items: + if "Cancun" in item.name and "yul" in item.fixturenames: + warnings.warn("Compiling Yul source with Shanghai, not Cancun.") + item.add_marker(pytest.mark.compile_yul_with("Shanghai"))