-
Notifications
You must be signed in to change notification settings - Fork 106
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pytest: compile Yul with --target-version shanghai when fork is cancun (
#174) * pytest: compile Yul with --target-version shanghai when fork is cancun * pytest: add a more verbose warning for yul compilation if ran with -vv * docs: fix gen_test_case_reference collect only when warnings are present
- Loading branch information
1 parent
8636cf6
commit bf37362
Showing
2 changed files
with
26 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
""" | ||
Pytest definitions applied to all tests. | ||
""" | ||
import warnings | ||
|
||
import pytest | ||
|
||
|
||
def pytest_collection_modifyitems(items, config): | ||
""" | ||
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: | ||
if config.getoption("verbose") >= 2: | ||
warnings.warn(f"Compiling Yul source for f{item.name} with Shanghai, not Cancun.") | ||
else: | ||
warnings.warn("Compiling Yul source with Shanghai, not Cancun.") | ||
item.add_marker(pytest.mark.compile_yul_with("Shanghai")) |