@@ -24,11 +24,11 @@ def doctree():
24
24
apps = []
25
25
syspath = sys .path [:]
26
26
27
- def doctree (source , config = None , return_warnings = False ):
27
+ def doctree (source , config = None , return_warnings = False , entrypoint = "jupyter_sphinx" ):
28
28
src_dir = tempfile .mkdtemp ()
29
29
source_trees .append (src_dir )
30
30
with open (os .path .join (src_dir , "conf.py" ), "w" ) as f :
31
- f .write ("extensions = ['jupyter_sphinx ']" )
31
+ f .write ("extensions = ['%s ']" % entrypoint )
32
32
if config is not None :
33
33
f .write ("\n " + config )
34
34
with open (os .path .join (src_dir , "contents.rst" ), "w" ) as f :
@@ -70,6 +70,22 @@ def test_basic(doctree):
70
70
assert cell .children [1 ].rawsource .strip () == "4"
71
71
72
72
73
+ def test_basic_old_entrypoint (doctree ):
74
+ source = """
75
+ .. jupyter-execute::
76
+
77
+ 2 + 2
78
+ """
79
+ tree = doctree (source , entrypoint = "jupyter_sphinx.execute" )
80
+ cell , = tree .traverse (JupyterCellNode )
81
+ assert cell .attributes ["code_below" ] is False
82
+ assert cell .attributes ["hide_code" ] is False
83
+ assert cell .attributes ["hide_output" ] is False
84
+ assert cell .attributes ["linenos" ] is False
85
+ assert cell .children [0 ].rawsource .strip () == "2 + 2"
86
+ assert cell .children [1 ].rawsource .strip () == "4"
87
+
88
+
73
89
def test_hide_output (doctree ):
74
90
source = """
75
91
.. jupyter-execute::
0 commit comments