Skip to content

Commit 87c5ca4

Browse files
authored
Add doc for using UNCOMMENT_TO_RUN
1 parent d16913a commit 87c5ca4

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

TESTING.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,3 +75,16 @@ Simply append the following line to the code cell specified in the Recording sec
7575
record_utils.playback()
7676
```
7777
Re-running the notebook will use the generated files made during recording.
78+
79+
## Testing commented code
80+
81+
In the example notebooks, some code cells are presented as commented out to prevent accidental execution of costly or long-running operations, particularly those that run on a QPU. However, commented code can become prone to errors over time due to lack of regular testing.
82+
83+
To improve test coverage, we introduce a special flag: `# UNCOMMENT_TO_RUN`. As a developer, you can include this flag within a cell to mark the beginning of a block that should be uncommented during integration testing. The integration test framework will detect the # UNCOMMENT_TO_RUN marker and automatically uncomment all subsequent lines until it encounters a line that is not commented.
84+
85+
To ensure this process works correctly:
86+
- Use a single `#` for code comments that should be uncommented during testing.
87+
- Use double `##` for non-code, descriptive comments that should remain commented (and not be treated as executable code).
88+
89+
Following this convention allows the integration test system to selectively and safely test example notebooks without risking unintended costly runs in normal usage.
90+

0 commit comments

Comments
 (0)