Skip to content

Commit b67d0a6

Browse files
committed
Fix windows runtime warning problem
Fix windows runtime warning problem Fix windows runtime warning issue
1 parent 7b2f321 commit b67d0a6

File tree

2 files changed

+7
-11
lines changed

2 files changed

+7
-11
lines changed

src/mqt/predictor/ml/predictor.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,10 @@ def _compile_all_circuits_devicewise(
191191
if (path_compiled_circuits / (target_filename + ".qasm")).exists():
192192
continue
193193
try:
194-
res = timeout_watcher(rl_compile, [qc, device, self.figure_of_merit, rl_pred], timeout)
194+
if sys.platform == "win32":
195+
res = rl_compile(qc, device, self.figure_of_merit, rl_pred)
196+
else:
197+
res = timeout_watcher(rl_compile, [qc, device, self.figure_of_merit, rl_pred], timeout)
195198
if isinstance(res, tuple):
196199
compiled_qc = res[0]
197200
with Path(path_compiled_circuits / (target_filename + ".qasm")).open("w", encoding="utf-8") as f:

tests/hellinger_distance/test_estimated_hellinger_distance.py

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
from __future__ import annotations
1212

1313
import re
14-
import sys
1514
import warnings
1615
from pathlib import Path
1716
from typing import TYPE_CHECKING
@@ -217,15 +216,9 @@ def test_train_and_qcompile_with_hellinger_model(source_path: Path, target_path:
217216
dump(qc, f)
218217

219218
# Generate compiled circuits (using trained RL model)
220-
if sys.platform == "win32":
221-
with pytest.warns(RuntimeWarning, match=re.escape("Timeout is not supported on Windows.")):
222-
ml_predictor.compile_training_circuits(
223-
timeout=6000, path_compiled_circuits=target_path, path_uncompiled_circuits=source_path
224-
)
225-
else:
226-
ml_predictor.compile_training_circuits(
227-
timeout=6000, path_compiled_circuits=target_path, path_uncompiled_circuits=source_path
228-
)
219+
ml_predictor.compile_training_circuits(
220+
timeout=6000, path_compiled_circuits=target_path, path_uncompiled_circuits=source_path
221+
)
229222

230223
# Generate training data from the compiled circuits
231224
ml_predictor.generate_training_data(path_uncompiled_circuits=source_path, path_compiled_circuits=target_path)

0 commit comments

Comments
 (0)