| 1 | diff --git a/src/_pytest/mark/evaluate.py b/src/_pytest/mark/evaluate.py |
| 2 | --- a/src/_pytest/mark/evaluate.py |
| 3 | +++ b/src/_pytest/mark/evaluate.py |
| 4 | @@ -10,25 +10,14 @@ |
| 5 | from ..outcomes import fail |
| 6 | from ..outcomes import TEST_OUTCOME |
| 7 | from .structures import Mark |
| 8 | -from _pytest.config import Config |
| 9 | from _pytest.nodes import Item |
| 10 | -from _pytest.store import StoreKey |
| 11 | |
| 12 | |
| 13 | -evalcache_key = StoreKey[Dict[str, Any]]() |
| 14 | +def compiled_eval(expr: str, d: Dict[str, object]) -> Any: |
| 15 | + import _pytest._code |
| 16 | |
| 17 | - |
| 18 | -def cached_eval(config: Config, expr: str, d: Dict[str, object]) -> Any: |
| 19 | - default = {} # type: Dict[str, object] |
| 20 | - evalcache = config._store.setdefault(evalcache_key, default) |
| 21 | - try: |
| 22 | - return evalcache[expr] |
| 23 | - except KeyError: |
| 24 | - import _pytest._code |
| 25 | - |
| 26 | - exprcode = _pytest._code.compile(expr, mode="eval") |
| 27 | - evalcache[expr] = x = eval(exprcode, d) |
| 28 | - return x |
| 29 | + exprcode = _pytest._code.compile(expr, mode="eval") |
| 30 | + return eval(exprcode, d) |
| 31 | |
| 32 | |
| 33 | class MarkEvaluator: |
| 34 | @@ -98,7 +87,7 @@ def _istrue(self) -> bool: |
| 35 | self.expr = expr |
| 36 | if isinstance(expr, str): |
| 37 | d = self._getglobals() |
| 38 | - result = cached_eval(self.item.config, expr, d) |
| 39 | + result = compiled_eval(expr, d) |
| 40 | else: |
| 41 | if "reason" not in mark.kwargs: |
| 42 | # XXX better be checked at collection time |