##// END OF EJS Templates
generate unicode filename...
MinRK -
Show More
@@ -13,13 +13,16 b' Contains base test class for nbconvert'
13 13 # Imports
14 14 #-----------------------------------------------------------------------------
15 15
16 import io
16 17 import os
17 18 import glob
18 19 import shutil
19 20 import unittest
20 21
21 22 import IPython
23 from IPython.nbformat import current
22 24 from IPython.utils.tempdir import TemporaryWorkingDirectory
25 from IPython.utils.path import get_ipython_package_dir
23 26 from IPython.utils.process import get_output_error_code
24 27 from IPython.testing.tools import get_ipython_cmd
25 28
@@ -111,6 +114,12 b' class TestsBase(unittest.TestCase):'
111 114 #Return directory handler
112 115 return temp_dir
113 116
117 def create_empty_notebook(self, path):
118 nb = current.new_notebook()
119 nb.worksheets.append(current.new_worksheet())
120 with io.open(path, 'w', encoding='utf-8') as f:
121 current.write(nb, f, 'json')
122
114 123
115 124 def copy_files_to(self, copy_filenames, dest='.'):
116 125 "Copy test files into the destination directory"
@@ -130,7 +139,7 b' class TestsBase(unittest.TestCase):'
130 139
131 140 #Build a path using the IPython directory and the relative path we just
132 141 #found.
133 path = IPython.__path__[0]
142 path = get_ipython_package_dir()
134 143 for name in names:
135 144 path = os.path.join(path, name)
136 145 return path
@@ -189,7 +189,8 b' class TestNbConvertApp(TestsBase):'
189 189 """
190 190 Can notebook names include accents?
191 191 """
192 with self.create_temp_cwd(['nb*.ipynb']):
192 with self.create_temp_cwd():
193 self.create_empty_notebook(u'nb1_análisis.ipynb')
193 194 self.call('nbconvert --log-level 0 --to python nb1_*')
194 195 assert os.path.isfile(u'nb1_análisis.py')
195 196
@@ -199,7 +200,8 b' class TestNbConvertApp(TestsBase):'
199 200 """
200 201 Generate PDFs if notebooks have an accent in their name?
201 202 """
202 with self.create_temp_cwd(['nb*.ipynb']):
203 with self.create_temp_cwd():
204 self.create_empty_notebook(u'nb1_análisis.ipynb')
203 205 o,e = self.call('nbconvert --log-level 0 --to latex '
204 206 '"nb1_*" --post PDF '
205 207 '--PDFPostProcessor.verbose=True')
1 NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now