Skip to content
This repository was archived by the owner on Aug 21, 2023. It is now read-only.

Commit 6e2914c

Browse files
committed
Make tutorial tests run all notebooks by default and configurable
This commit updates the often forgotten about test module to actually be runnable by default. It also makes the hard coded values for path, kernel, and timeout configurable via env variables so people can adjust these easily without having to hand edit code. The exlusion list option was not added because doing that in a test module is redundant a decent test runner will support test selection in a more robust manner and that should be leveraged instead of exclusion list. In addition because the notebook execution can be slow this commit also adds a .stestr.conf file so that we can run the notebooks in parallel (just like we do for the terra unit tests). This can be done with 'stestr run' and by default it will run as many processes as you have cpus to run a notebook each (assuming you have stestr pip installed along with the notebook dependencies).
1 parent 66f22da commit 6e2914c

3 files changed

Lines changed: 7 additions & 3 deletions

File tree

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,5 @@ qiskit/basics/Qconfig_IBMQ_network-dev.py
3232
.DS_Store
3333

3434
qiskit/.ipynb_checkpoints/start_here-checkpoint.ipynb
35+
36+
.stestr/

.stestr.conf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[DEFAULT]
2+
test_path=./utils/test

utils/test/test_tutorials.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,11 @@
5252
# List of manual exclusion (for example, ["reference/foo/problematic.ipynb"]).
5353
EXCLUDED_NOTEBOOKS = []
5454
# Timeout (in seconds) for a single notebook.
55-
TIMEOUT = 6000
55+
TIMEOUT = os.getenv('TIMEOUT', 6000)
5656
# Jupyter kernel to execute the notebook in.
57-
JUPYTER_KERNEL = 'python3'
57+
JUPYTER_KERNEL = os.getenv('JUPYTER_KERNEL', 'python3')
5858
# Glob expression for discovering the notebooks.
59-
NOTEBOOK_PATH = 'reference/**/*.ipynb'
59+
NOTEBOOK_PATH = os.getenv('NOTEBOOK_PATH', 'qiskit/**/*.ipynb')
6060

6161

6262
# Retrieve the notebooks recursively.

0 commit comments

Comments
 (0)