Code inside an excluded ``only`` block should not be executed. When building with the html builder, an ``only:: latex`` directive should cause the ipython directive to skip code execution. See gh-9339.
()
| 57 | |
| 58 | |
| 59 | def test_only_excluded_skips_execution(): |
| 60 | """Code inside an excluded ``only`` block should not be executed. |
| 61 | |
| 62 | When building with the html builder, an ``only:: latex`` directive |
| 63 | should cause the ipython directive to skip code execution. See gh-9339. |
| 64 | """ |
| 65 | n = _build_sphinx( |
| 66 | """ |
| 67 | Test |
| 68 | ==== |
| 69 | |
| 70 | .. only:: latex |
| 71 | |
| 72 | .. ipython:: |
| 73 | |
| 74 | In [1]: x = 1 |
| 75 | |
| 76 | .. ipython:: |
| 77 | |
| 78 | In [1]: y = 2 |
| 79 | """, |
| 80 | builder="html", |
| 81 | tags=["html"], |
| 82 | ) |
| 83 | # The directive inside only:: latex is skipped; the one outside runs. |
| 84 | assert n == 1 |
| 85 | |
| 86 | |
| 87 | def test_only_included_executes_normally(): |
nothing calls this directly
no test coverage detected
searching dependent graphs…