Skip to content

Commit

Permalink
Fix tests - bump timeouts & fix cwd
Browse files Browse the repository at this point in the history
  • Loading branch information
classiqdor committed Mar 6, 2025
1 parent 3f01612 commit 8cb9872
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 5 deletions.
4 changes: 3 additions & 1 deletion tests/notebooks/test_bernstein_vazirani_tutorial.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
import numpy as np


@wrap_testbook("bernstein_vazirani_tutorial", timeout_seconds=30)
@wrap_testbook(
"bernstein_vazirani_tutorial", timeout_seconds=100
) # 2025.03.06 bump from 30 seconds
def test_notebook(tb: TestbookNotebookClient) -> None:
# test models
validate_quantum_model(tb.ref("qmod"))
Expand Down
4 changes: 3 additions & 1 deletion tests/notebooks/test_hamiltonian_simulation_guide.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
from testbook.client import TestbookNotebookClient


@wrap_testbook("hamiltonian_simulation_guide", timeout_seconds=1000)
@wrap_testbook(
"hamiltonian_simulation_guide", timeout_seconds=2000
) # 2025.03.06 bump from 1000 seconds
def test_notebook(tb: TestbookNotebookClient) -> None:
# test models
validate_quantum_model(tb.ref("qmod_trotter"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
)
from testbook.client import TestbookNotebookClient

import numpy as np


@wrap_testbook("hamiltonian_simulation_with_block_encoding", timeout_seconds=600)
def test_notebook(tb: TestbookNotebookClient) -> None:
Expand Down
4 changes: 3 additions & 1 deletion tests/notebooks/test_learning_optimization.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
from testbook.client import TestbookNotebookClient


@wrap_testbook("learning_optimization", timeout_seconds=80)
@wrap_testbook(
"learning_optimization", timeout_seconds=200
) # 2025.03.06 bump from 80 seconds
def test_notebook(tb: TestbookNotebookClient) -> None:
# test models
validate_quantum_model(tb.ref("qmod_1"))
Expand Down
2 changes: 1 addition & 1 deletion tests/notebooks/test_mcx.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def test_notebook(tb: TestbookNotebookClient) -> None:
validate_quantum_program_size(
tb.ref("qprog_4"),
expected_width=80, # actual width: 69
expected_depth=600, # actual depth: 494
expected_depth=1500, # actual depth: 494 ; also was 920
)

# test notebook content
Expand Down
3 changes: 2 additions & 1 deletion tests/test_notebooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from contextlib import contextmanager

from testbook import testbook # type: ignore[import]
from utils_for_tests import iterate_notebooks
from utils_for_tests import iterate_notebooks, ROOT_DIRECTORY

TIMEOUT: int = 60 * 10 # 10 minutes
LOGGER = logging.getLogger(__name__)
Expand All @@ -22,6 +22,7 @@ def test_notebooks() -> None:
@contextmanager
def cwd(path):
oldpwd = os.getcwd()
os.chdir(ROOT_DIRECTORY)
os.chdir(path)
try:
yield
Expand Down

0 comments on commit 8cb9872

Please sign in to comment.