4
4
from __future__ import annotations
5
5
6
6
from collections .abc import Iterable , Mapping
7
- from functools import cache , partial
7
+ from functools import partial
8
8
from pathlib import Path
9
9
from typing import TYPE_CHECKING , Any
10
10
import json
@@ -47,15 +47,13 @@ def _find_suite():
47
47
class Suite :
48
48
49
49
_root : Path = field (factory = _find_suite )
50
+ _remotes : Mapping [str , Mapping [str , Any ] | bool ] = field (init = False )
50
51
51
- @property
52
- @cache # noqa: B019
53
- def _remotes (self ) -> Mapping [str , Mapping [str , Any ] | bool ]:
52
+ def __attrs_post_init__ (self ):
54
53
jsonschema_suite = self ._root .joinpath ("bin" , "jsonschema_suite" )
55
- remotes = subprocess .check_output (
56
- [sys .executable , str (jsonschema_suite ), "remotes" ],
57
- )
58
- return json .loads (remotes .decode ("utf-8" ))
54
+ argv = [sys .executable , str (jsonschema_suite ), "remotes" ]
55
+ remotes = subprocess .check_output (argv ).decode ("utf-8" )
56
+ object .__setattr__ (self , "_remotes" , json .loads (remotes ))
59
57
60
58
def benchmark (self , runner : pyperf .Runner ): # pragma: no cover
61
59
for name , Validator in _VALIDATORS .items ():
@@ -68,7 +66,7 @@ def version(self, name) -> Version:
68
66
return Version (
69
67
name = name ,
70
68
path = self ._root / "tests" / name ,
71
- remotes = self ._remotes , # type: ignore # python/mypy#5858
69
+ remotes = self ._remotes ,
72
70
)
73
71
74
72
0 commit comments