Notebook Tests in QMCPy
Contents
.gitignore: ignores temporary files and generated test outputs in this directory.__init__.py: package marker for thetest.booktestsmodule.generate_test.py: script that generatestb_*.pytest files from notebooks indemos/.parsl_test_runner.py: helper harness used to run Parsl-based notebook tests and coordinate workers.README.md: this documentation file describing how to run and manage the notebook tests.
Overview
To execute an individual testbook file, e.g., tb_acm_toms_sorokin_2025.py, run the following command in a terminal:
To execute all testbook files sequentially, run the following command in a terminal:
To execute all testbook files in parallel using Parsl, run the following command in a terminal:
To execute say two testbook files sequentially, run the following command in a terminal:
To execute say two testbook files in parallel, run the following command in a terminal:
For a demo, see the Jupyter notebook, demos/talk_paper_demos/Parslfest_2025/.
Design Patterns: Using setUp/helpers vs. @testbook Decorator**
- Generated files such as
tb_iris.pyuses@testbookfor a standalone notebook, requiring no special setup. - GBM notebooks such as
gbm_examples.pyrely on local modules and sometimes have broken symlinks, needing setup for correct imports. - Running notebooks from their directory (via
setUp) ensures consistent relative paths and imports, which the decorator doesn't reliably handle. BaseNotebookTest'ssetUp/tearDownmethods handle resource management, beneficial for long-running demos.- Shared helper functions in
__init__.pycentralize complex logic (location, symlink fixing, running) for reusability and clarity.