Skip to content

Commit

Permalink
Skip the tests for jupytext --execute if a timeout occurs (#489)
Browse files Browse the repository at this point in the history
  • Loading branch information
mwouts committed Apr 11, 2020
1 parent 58c3b0a commit a0164dc
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 6 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ Next release (2020-04-??)
- Jupytext is tested in `pip` and `conda` environments, on Linux, Mac OS and Windows, using Github actions (#487)
- Documented that the YAML header can be created with either `--set-kernel`, `--set-formats`, or both (#485)

**Fixed**
- Skip the `jupytext --execute` tests when the warning _Timeout waiting for IOPub output_ occurs, which is the case intermittently on Windows (#489)

1.4.2 (2020-04-05)
------------------

Expand Down
24 changes: 18 additions & 6 deletions tests/test_execute.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@


@requires_nbconvert
def test_pipe_nbconvert_execute(tmpdir):
def test_pipe_nbconvert_execute(tmpdir, caplog):
tmp_ipynb = str(tmpdir.join('notebook.ipynb'))
tmp_py = str(tmpdir.join('notebook.py'))

Expand All @@ -15,14 +15,16 @@ def test_pipe_nbconvert_execute(tmpdir):

jupytext(args=[tmp_py, '--to', 'ipynb', '--pipe-fmt', 'ipynb',
'--pipe', 'jupyter nbconvert --stdin --stdout --to notebook --execute'])
if "Timeout" in caplog.text:
pytest.skip(caplog.text) # Issue 489

nb = read(tmp_ipynb)
assert len(nb.cells) == 1
assert nb.cells[0].outputs[0]['data'] == {'text/plain': '3'}


@requires_nbconvert
def test_pipe_nbconvert_execute_sync(tmpdir):
def test_pipe_nbconvert_execute_sync(tmpdir, caplog):
tmp_ipynb = str(tmpdir.join('notebook.ipynb'))
tmp_py = str(tmpdir.join('notebook.py'))

Expand All @@ -32,14 +34,16 @@ def test_pipe_nbconvert_execute_sync(tmpdir):

jupytext(args=[tmp_py, '--set-formats', 'py,ipynb', '--sync', '--pipe-fmt', 'ipynb',
'--pipe', 'jupyter nbconvert --stdin --stdout --to notebook --execute'])
if "Timeout" in caplog.text:
pytest.skip(caplog.text) # Issue 489

nb = read(tmp_ipynb)
assert len(nb.cells) == 1
assert nb.cells[0].outputs[0]['data'] == {'text/plain': '3'}


@requires_nbconvert
def test_execute(tmpdir):
def test_execute(tmpdir, caplog):
tmp_ipynb = str(tmpdir.join('notebook.ipynb'))
tmp_py = str(tmpdir.join('notebook.py'))

Expand All @@ -48,6 +52,8 @@ def test_execute(tmpdir):
""")

jupytext(args=[tmp_py, '--to', 'ipynb', '--execute'])
if "Timeout" in caplog.text:
pytest.skip(caplog.text) # Issue 489

nb = read(tmp_ipynb)
assert len(nb.cells) == 1
Expand Down Expand Up @@ -89,7 +95,7 @@ def test_execute_readme_not_ok(tmpdir):


@requires_nbconvert
def test_execute_sync(tmpdir):
def test_execute_sync(tmpdir, caplog):
tmp_ipynb = str(tmpdir.join('notebook.ipynb'))
tmp_py = str(tmpdir.join('notebook.py'))

Expand All @@ -98,6 +104,8 @@ def test_execute_sync(tmpdir):
""")

jupytext(args=[tmp_py, '--set-formats', 'py,ipynb', '--sync', '--execute'])
if "Timeout" in caplog.text:
pytest.skip(caplog.text) # Issue 489

nb = read(tmp_ipynb)
assert len(nb.cells) == 1
Expand All @@ -106,7 +114,7 @@ def test_execute_sync(tmpdir):

@requires_nbconvert
@requires_ir_kernel
def test_execute_r(tmpdir): # pragma: no cover
def test_execute_r(tmpdir, caplog): # pragma: no cover
tmp_ipynb = str(tmpdir.join('notebook.ipynb'))
tmp_md = str(tmpdir.join('notebook.md'))

Expand All @@ -117,14 +125,16 @@ def test_execute_r(tmpdir): # pragma: no cover
""")

jupytext(args=[tmp_md, '--to', 'ipynb', '--execute'])
if "Timeout" in caplog.text:
pytest.skip(caplog.text) # Issue 489

nb = read(tmp_ipynb)
assert len(nb.cells) == 1
assert nb.cells[0].outputs[0]['data']['text/markdown'] == '6'


@requires_nbconvert
def test_execute_in_subfolder(tmpdir):
def test_execute_in_subfolder(tmpdir, caplog):
tmpdir.mkdir('subfolder')

tmp_csv = str(tmpdir.join('subfolder', 'inputs.csv'))
Expand All @@ -144,6 +154,8 @@ def test_execute_in_subfolder(tmpdir):
""")

jupytext(args=[tmp_py, '--to', 'ipynb', '--execute'])
if "Timeout" in caplog.text:
pytest.skip(caplog.text) # Issue 489

nb = read(tmp_ipynb)
assert len(nb.cells) == 3
Expand Down

0 comments on commit a0164dc

Please sign in to comment.