Spec Version Checker Plugin¶
A pytest plugin that verifies the tested version of an EIP specification against the latest version from the ethereum/EIPs Github repository.
A pytest plugin that checks that the spec version specified in test/filler modules matches that of https://github.com/ethereum/EIPs.
pytest_configure(config)
¶
Register the plugin's custom markers and process command-line options.
Custom marker registration: https://docs.pytest.org/en/7.1.x/how-to/writing_plugins.html#registering-custom-markers
Source code in /home/dtopz/code/github/danceratopz/execution-spec-tests/src/pytest_plugins/spec_version_checker/spec_version_checker.py
16 17 18 19 20 21 22 23 24 25 26 27 |
|
ReferenceSpec
¶
Reference Specification Description Abstract Class.
Source code in /home/dtopz/code/github/danceratopz/execution-spec-tests/src/ethereum_test_tools/reference_spec/reference_spec.py
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
|
name()
abstractmethod
¶
Returns the name of the spec.
Source code in /home/dtopz/code/github/danceratopz/execution-spec-tests/src/ethereum_test_tools/reference_spec/reference_spec.py
35 36 37 38 39 40 |
|
has_known_version()
abstractmethod
¶
Returns true if the reference spec object is hard-coded with a latest known version.
Source code in /home/dtopz/code/github/danceratopz/execution-spec-tests/src/ethereum_test_tools/reference_spec/reference_spec.py
42 43 44 45 46 47 48 |
|
known_version()
abstractmethod
¶
Returns the latest known version in the reference.
Source code in /home/dtopz/code/github/danceratopz/execution-spec-tests/src/ethereum_test_tools/reference_spec/reference_spec.py
50 51 52 53 54 55 |
|
api_url()
abstractmethod
¶
Returns the URL required to poll the version from an API, if needed.
Source code in /home/dtopz/code/github/danceratopz/execution-spec-tests/src/ethereum_test_tools/reference_spec/reference_spec.py
57 58 59 60 61 62 |
|
latest_version()
abstractmethod
¶
Returns a digest that points to the latest version of the spec.
Source code in /home/dtopz/code/github/danceratopz/execution-spec-tests/src/ethereum_test_tools/reference_spec/reference_spec.py
64 65 66 67 68 69 |
|
is_outdated()
abstractmethod
¶
Checks whether the reference specification has been updated since the test was last updated.
Source code in /home/dtopz/code/github/danceratopz/execution-spec-tests/src/ethereum_test_tools/reference_spec/reference_spec.py
71 72 73 74 75 76 77 |
|
write_info(info)
abstractmethod
¶
Writes info about the reference specification used into the output fixture.
Source code in /home/dtopz/code/github/danceratopz/execution-spec-tests/src/ethereum_test_tools/reference_spec/reference_spec.py
79 80 81 82 83 84 85 |
|
parseable_from_module(module_dict)
staticmethod
abstractmethod
¶
Checks whether the module's dict contains required reference spec information.
Source code in /home/dtopz/code/github/danceratopz/execution-spec-tests/src/ethereum_test_tools/reference_spec/reference_spec.py
87 88 89 90 91 92 93 94 |
|
parse_from_module(module_dict)
staticmethod
abstractmethod
¶
Parses the module's dict into a reference spec.
Source code in /home/dtopz/code/github/danceratopz/execution-spec-tests/src/ethereum_test_tools/reference_spec/reference_spec.py
96 97 98 99 100 101 102 |
|
get_ref_spec_from_module(module)
¶
Return the reference spec object defined in a module.
Raises:
Type | Description |
---|---|
Exception
|
If the module path contains "eip" and the module does not define a reference spec. |
Returns:
Name | Type | Description |
---|---|---|
spec_obj |
None | ReferenceSpec
|
Return None if the module path does not contain "eip", i.e., the module is not required to define a reference spec, otherwise, return the ReferenceSpec object as defined by the module. |
Source code in /home/dtopz/code/github/danceratopz/execution-spec-tests/src/pytest_plugins/spec_version_checker/spec_version_checker.py
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
|
reference_spec(request)
¶
Pytest fixture that returns the reference spec defined in a module.
See get_ref_spec_from_module
.
Source code in /home/dtopz/code/github/danceratopz/execution-spec-tests/src/pytest_plugins/spec_version_checker/spec_version_checker.py
63 64 65 66 67 68 69 70 |
|
is_test_for_an_eip(input_string)
¶
Return True if input_string
contains an EIP number, i.e., eipNNNN.
Source code in /home/dtopz/code/github/danceratopz/execution-spec-tests/src/pytest_plugins/spec_version_checker/spec_version_checker.py
73 74 75 76 77 78 79 80 |
|
test_eip_spec_version(module)
¶
Test that the ReferenceSpec object as defined in the test module is not outdated when compared to the remote hash from ethereum/EIPs.
Source code in /home/dtopz/code/github/danceratopz/execution-spec-tests/src/pytest_plugins/spec_version_checker/spec_version_checker.py
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
|
EIPSpecTestItem
¶
Bases: Item
Custom pytest test item to test EIP spec versions.
Source code in /home/dtopz/code/github/danceratopz/execution-spec-tests/src/pytest_plugins/spec_version_checker/spec_version_checker.py
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 |
|
from_parent(parent, module)
classmethod
¶
Public constructor to define new tests. https://docs.pytest.org/en/latest/reference/reference.html#pytest.nodes.Node.from_parent
Source code in /home/dtopz/code/github/danceratopz/execution-spec-tests/src/pytest_plugins/spec_version_checker/spec_version_checker.py
120 121 122 123 124 125 126 |
|
runtest()
¶
Define the test to execute for this item.
Source code in /home/dtopz/code/github/danceratopz/execution-spec-tests/src/pytest_plugins/spec_version_checker/spec_version_checker.py
128 129 130 131 132 |
|
reportinfo()
¶
Get location information for this test item to use test reports.
Source code in /home/dtopz/code/github/danceratopz/execution-spec-tests/src/pytest_plugins/spec_version_checker/spec_version_checker.py
134 135 136 137 138 |
|
pytest_collection_modifyitems(session, config, items)
¶
Insert a new test EIPSpecTestItem for every test modules that contains 'eip' in its path.
Source code in /home/dtopz/code/github/danceratopz/execution-spec-tests/src/pytest_plugins/spec_version_checker/spec_version_checker.py
141 142 143 144 145 146 147 148 149 150 151 152 153 154 |
|