Skip to content

Commit ec6df86

Browse files
committed
test for old entrypoint
1 parent 86adda3 commit ec6df86

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

tests/test_execute.py

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ def doctree():
2424
apps = []
2525
syspath = sys.path[:]
2626

27-
def doctree(source, config=None, return_warnings=False):
27+
def doctree(source, config=None, return_warnings=False, entrypoint="jupyter_sphinx"):
2828
src_dir = tempfile.mkdtemp()
2929
source_trees.append(src_dir)
3030
with open(os.path.join(src_dir, "conf.py"), "w") as f:
31-
f.write("extensions = ['jupyter_sphinx']")
31+
f.write("extensions = ['%s']" % entrypoint)
3232
if config is not None:
3333
f.write("\n" + config)
3434
with open(os.path.join(src_dir, "contents.rst"), "w") as f:
@@ -70,6 +70,22 @@ def test_basic(doctree):
7070
assert cell.children[1].rawsource.strip() == "4"
7171

7272

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+
7389
def test_hide_output(doctree):
7490
source = """
7591
.. jupyter-execute::

0 commit comments

Comments
 (0)