1
1
# coding: utf-8
2
- import io
3
2
import json
4
- import os
5
- from os .path import join as pjoin
6
- import shutil
7
3
8
4
import tornado
9
5
12
8
new_notebook , new_markdown_cell , new_code_cell , new_output ,
13
9
)
14
10
15
- from ipython_genutils .testing .decorators import onlyif_cmds_exist
11
+ from ipython_genutils .py3compat import which
12
+
16
13
17
14
from base64 import encodebytes
18
15
@@ -50,7 +47,9 @@ def notebook(jp_root_dir):
50
47
nbfile .write_text (writes (nb , version = 4 ), encoding = 'utf-8' )
51
48
52
49
53
- @onlyif_cmds_exist ('pandoc' )
50
+ pytestmark = pytest .mark .skipif (not which ('pandoc' ), reason = "Command 'pandoc' is not available" )
51
+
52
+
54
53
async def test_from_file (jp_fetch , notebook ):
55
54
r = await jp_fetch (
56
55
'nbconvert' , 'html' , 'foo' , 'testnb.ipynb' ,
@@ -74,7 +73,6 @@ async def test_from_file(jp_fetch, notebook):
74
73
assert 'print(2*6)' in r .body .decode ()
75
74
76
75
77
- @onlyif_cmds_exist ('pandoc' )
78
76
async def test_from_file_404 (jp_fetch , notebook ):
79
77
with pytest .raises (tornado .httpclient .HTTPClientError ) as e :
80
78
await jp_fetch (
@@ -85,7 +83,6 @@ async def test_from_file_404(jp_fetch, notebook):
85
83
assert expected_http_error (e , 404 )
86
84
87
85
88
- @onlyif_cmds_exist ('pandoc' )
89
86
async def test_from_file_download (jp_fetch , notebook ):
90
87
r = await jp_fetch (
91
88
'nbconvert' , 'python' , 'foo' , 'testnb.ipynb' ,
@@ -97,7 +94,6 @@ async def test_from_file_download(jp_fetch, notebook):
97
94
assert 'testnb.py' in content_disposition
98
95
99
96
100
- @onlyif_cmds_exist ('pandoc' )
101
97
async def test_from_file_zip (jp_fetch , notebook ):
102
98
r = await jp_fetch (
103
99
'nbconvert' , 'latex' , 'foo' , 'testnb.ipynb' ,
@@ -108,7 +104,6 @@ async def test_from_file_zip(jp_fetch, notebook):
108
104
assert '.zip' in r .headers ['Content-Disposition' ]
109
105
110
106
111
- @onlyif_cmds_exist ('pandoc' )
112
107
async def test_from_post (jp_fetch , notebook ):
113
108
r = await jp_fetch (
114
109
'api/contents/foo/testnb.ipynb' ,
@@ -136,7 +131,6 @@ async def test_from_post(jp_fetch, notebook):
136
131
assert 'print(2*6)' in r .body .decode ()
137
132
138
133
139
- @onlyif_cmds_exist ('pandoc' )
140
134
async def test_from_post_zip (jp_fetch , notebook ):
141
135
r = await jp_fetch (
142
136
'api/contents/foo/testnb.ipynb' ,
0 commit comments