MCPcopy Index your code
hub / github.com/ipython/ipython / test_only_excluded_skips_execution

Function test_only_excluded_skips_execution

tests/test_ipython_directive.py:59–84  ·  view source on GitHub ↗

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.

()

Source from the content-addressed store, hash-verified

57
58
59def 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 """
67Test
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
87def test_only_included_executes_normally():

Callers

nothing calls this directly

Calls 1

_build_sphinxFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…