File tree 2 files changed +13
-7
lines changed 2 files changed +13
-7
lines changed Original file line number Diff line number Diff line change 1
1
from __future__ import annotations
2
2
3
+ from pathlib import Path
3
4
from typing import TYPE_CHECKING
4
5
5
6
import pytest
6
- from pyk .cli .utils import dir_path
7
7
8
8
if TYPE_CHECKING :
9
- from pathlib import Path
10
-
11
9
from pytest import FixtureRequest , Parser
12
10
13
11
@@ -32,7 +30,7 @@ def pytest_addoption(parser: Parser) -> None:
32
30
)
33
31
parser .addoption (
34
32
'--kompiled-targets-dir' ,
35
- type = dir_path ,
33
+ type = Path ,
36
34
help = 'Use pre-kompiled definitions for proof tests' ,
37
35
)
38
36
Original file line number Diff line number Diff line change @@ -139,12 +139,20 @@ def __call__(self, output_dir: Path) -> Path:
139
139
140
140
141
141
@pytest .fixture (scope = 'module' )
142
- def kompiled_target_for (tmp_path_factory : TempPathFactory , kompiled_targets_dir : Path | None ) -> Callable [[Path ], Path ]:
142
+ def target_dir (kompiled_targets_dir : Path | None , tmp_path_factory : TempPathFactory ) -> Path :
143
+ if kompiled_targets_dir :
144
+ kompiled_targets_dir .mkdir (parents = True , exist_ok = True )
145
+ return kompiled_targets_dir
146
+
147
+ return tmp_path_factory .mktemp ('kompiled' )
148
+
149
+
150
+
151
+ @pytest .fixture (scope = 'module' )
152
+ def kompiled_target_for (target_dir : Path ) -> Callable [[Path ], Path ]:
143
153
"""
144
154
Generate a function that returns a path to the kompiled defintion for a given K spec. Invoke `kompile` only if no kompiled directory is cached for the spec.
145
155
"""
146
- target_dir = kompiled_targets_dir or tmp_path_factory .mktemp ('kompiled' )
147
-
148
156
def kompile (spec_file : Path ) -> Path :
149
157
target = _target_for_spec (spec_file )
150
158
lock_file = target_dir / f'{ target .id } .lock'
You can’t perform that action at this time.
0 commit comments