Skip to content

Commit 66ca184

Browse files
chore(specs): avoid using an itertools object in the BaseTest pydantic model (#1414)
* chore(specs): avoid using an itertools object as a pydantic model attribute Pydantic does a deepcopy of the model upon validation which triggers the following deprecation warning: ``` tests/istanbul/eip1344_chainid/test_chainid.py: 24 warnings /usr/lib/python3.12/copy.py:151: DeprecationWarning: Pickle, copy, and deepcopy support will be removed from itertools in Python 3.14. rv = reductor(4) ``` * docs: update changelog --------- Co-authored-by: Mario Vega <[email protected]>
1 parent 5325008 commit 66ca184

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

docs/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ Test fixtures for use by clients are available for each release on the [Github r
1010

1111
### 🛠️ Framework
1212

13+
#### `fill`
14+
15+
- 🐞 Fix `DeprecationWarning: Pickle, copy, and deepcopy support will be removed from itertools in Python 3.14.` by avoiding use `itertools` object in the spec `BaseTest` pydantic model ([#1414](https://github.com/ethereum/execution-spec-tests/pull/1414)).
1316
- ✨ The `static_filler` plug-in now has support for static state tests (from [GeneralStateTests](https://github.com/ethereum/tests/tree/develop/src/GeneralStateTestsFiller)) ([#1362](https://github.com/ethereum/execution-spec-tests/pull/1362)).
1417

1518
### 📋 Misc

src/ethereum_test_specs/base.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@
22

33
from abc import abstractmethod
44
from functools import reduce
5-
from itertools import count
65
from os import path
76
from pathlib import Path
8-
from typing import Callable, ClassVar, Dict, Generator, Iterator, List, Optional, Sequence
7+
from typing import Callable, ClassVar, Dict, Generator, List, Optional, Sequence
98

109
import pytest
1110
from pydantic import BaseModel, Field
@@ -49,7 +48,7 @@ class BaseTest(BaseModel):
4948

5049
# Transition tool specific fields
5150
t8n_dump_dir: Path | None = Field(None, exclude=True)
52-
_t8n_call_counter: Iterator[int] = count(0)
51+
t8n_call_counter: int = Field(0, exclude=True)
5352

5453
supported_fixture_formats: ClassVar[Sequence[FixtureFormat | LabeledFixtureFormat]] = []
5554
supported_execute_formats: ClassVar[Sequence[LabeledExecuteFormat]] = []
@@ -113,9 +112,11 @@ def get_next_transition_tool_output_path(self) -> str:
113112
"""Return path to the next transition tool output file."""
114113
if not self.t8n_dump_dir:
115114
return ""
115+
current_value = self.t8n_call_counter
116+
self.t8n_call_counter += 1
116117
return path.join(
117118
self.t8n_dump_dir,
118-
str(next(self._t8n_call_counter)),
119+
str(current_value),
119120
)
120121

121122

0 commit comments

Comments
 (0)