Skip to content

Commit d14d20f

Browse files
committed
Applied alt_tmp_path to compiler pytest and removed deprecated code
1 parent cdd1661 commit d14d20f

File tree

2 files changed

+3
-16
lines changed

2 files changed

+3
-16
lines changed

quantcrypt/internal/cli/commands/compile.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
# SPDX-License-Identifier: MIT
1010
#
1111

12-
import os
13-
import sys
1412
import platform
1513
from typer import Typer
1614
from quantcrypt.internal import constants as const
@@ -28,11 +26,6 @@
2826
)
2927

3028

31-
def run_compiler(variants: list[const.PQAVariant]) -> None:
32-
sys.stdout = open(os.devnull, 'w')
33-
Compiler().run(variants)
34-
35-
3629
@compile_app.callback()
3730
def command_compile(
3831
algorithms: ats.CompileAlgos = None,

tests/test_compiler.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,26 +9,20 @@
99
# SPDX-License-Identifier: MIT
1010
#
1111

12-
import secrets
13-
import tempfile
1412
from pathlib import Path
1513
from quantcrypt.internal import utils, constants as const
1614
from quantcrypt.internal.compiler import Compiler
1715

1816

19-
def test_compiler_run(monkeypatch):
20-
base_path = Path(tempfile.gettempdir())
21-
test_path = base_path / "pytest" / secrets.token_hex(10)
22-
test_path.mkdir(parents=True, exist_ok=True)
23-
17+
def test_compiler_run(monkeypatch, alt_tmp_path):
2418
def _mocked_search_upwards(_path: Path | str):
25-
sub_path = test_path / _path
19+
sub_path = alt_tmp_path / _path
2620
sub_path.mkdir(parents=True, exist_ok=True)
2721
return sub_path
2822

2923
monkeypatch.setattr(utils, "search_upwards", _mocked_search_upwards)
3024

31-
bin_path = test_path / "bin"
25+
bin_path = alt_tmp_path / "bin"
3226
old_file = bin_path / "old_file"
3327
old_folder = bin_path / "old_folder"
3428
old_folder.mkdir(parents=True)

0 commit comments

Comments
 (0)