Skip to content

Commit 82cbc9f

Browse files
committed
Create kompiled_targets_dir if it does not exist
1 parent e03598d commit 82cbc9f

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

kevm-pyk/src/tests/conftest.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
from __future__ import annotations
22

3+
from pathlib import Path
34
from typing import TYPE_CHECKING
45

56
import pytest
6-
from pyk.cli.utils import dir_path
77

88
if TYPE_CHECKING:
9-
from pathlib import Path
10-
119
from pytest import FixtureRequest, Parser
1210

1311

@@ -32,7 +30,7 @@ def pytest_addoption(parser: Parser) -> None:
3230
)
3331
parser.addoption(
3432
'--kompiled-targets-dir',
35-
type=dir_path,
33+
type=Path,
3634
help='Use pre-kompiled definitions for proof tests',
3735
)
3836

kevm-pyk/src/tests/integration/test_prove.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,12 +139,20 @@ def __call__(self, output_dir: Path) -> Path:
139139

140140

141141
@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]:
143153
"""
144154
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.
145155
"""
146-
target_dir = kompiled_targets_dir or tmp_path_factory.mktemp('kompiled')
147-
148156
def kompile(spec_file: Path) -> Path:
149157
target = _target_for_spec(spec_file)
150158
lock_file = target_dir / f'{target.id}.lock'

0 commit comments

Comments
 (0)