-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
19 additions
and
0 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -253,6 +253,25 @@ def test_something_with_all_tx_types( | |
|
||
Ideally, the lambda function should be used to explicitly filter out values that are not compatible with the test (exclusive filter), rather than explicitly selecting values (inclusive filter), as the parametrized values might change with future forks. | ||
|
||
#### `marks` | ||
|
||
A marker, list of markers, or a lambda function that can be used to add additional markers to the test. | ||
|
||
```python | ||
import pytest | ||
|
||
@pytest.mark.with_all_tx_types( | ||
marks=lambda tx_type: pytest.mark.skip("incompatible") if tx_type == 1 else None, | ||
) | ||
@pytest.mark.valid_from("London") | ||
def test_something_with_all_tx_types_but_skip_type_1(state_test_only, tx_type): | ||
assert tx_type != 1 | ||
... | ||
``` | ||
|
||
In this example, the test will be skipped if `tx_type` is equal to 1 by returning a `pytest.mark.skip` marker, and return `None` otherwise. | ||
|
||
|
||
Check failure on line 274 in docs/writing_tests/test_markers.md
|
||
## Other Markers | ||
|
||
### `@pytest.mark.slow` | ||
|