Show More
@@ -0,0 +1,7 b'' | |||||
|
1 | from IPython.nbconvert.writers.base import WriterBase | |||
|
2 | ||||
|
3 | class HelloWriter(WriterBase): | |||
|
4 | ||||
|
5 | def write(self, output, resources, notebook_name=None, **kw): | |||
|
6 | with open('hello.txt', 'w') as outfile: | |||
|
7 | outfile.write('hello world') |
@@ -199,8 +199,8 b' class NbConvertApp(BaseIPythonApplication):' | |||||
199 |
|
199 | |||
200 | @catch_config_error |
|
200 | @catch_config_error | |
201 | def initialize(self, argv=None): |
|
201 | def initialize(self, argv=None): | |
202 | super(NbConvertApp, self).initialize(argv) |
|
|||
203 | self.init_syspath() |
|
202 | self.init_syspath() | |
|
203 | super(NbConvertApp, self).initialize(argv) | |||
204 | self.init_notebooks() |
|
204 | self.init_notebooks() | |
205 | self.init_writer() |
|
205 | self.init_writer() | |
206 | self.init_postprocessor() |
|
206 | self.init_postprocessor() |
@@ -200,3 +200,12 b' class TestNbConvertApp(TestsBase):' | |||||
200 | '--PDFPostProcessor.verbose=True') |
|
200 | '--PDFPostProcessor.verbose=True') | |
201 | assert os.path.isfile(u'nb1_análisis.tex') |
|
201 | assert os.path.isfile(u'nb1_análisis.tex') | |
202 | assert os.path.isfile(u'nb1_análisis.pdf') |
|
202 | assert os.path.isfile(u'nb1_análisis.pdf') | |
|
203 | ||||
|
204 | def test_cwd_plugin(self): | |||
|
205 | """ | |||
|
206 | Verify that an extension in the cwd can be imported. | |||
|
207 | """ | |||
|
208 | with self.create_temp_cwd(['hello.py']): | |||
|
209 | self.create_empty_notebook(u'empty.ipynb') | |||
|
210 | self.call('nbconvert empty --to html --NbConvertApp.writer_class=\'hello.HelloWriter\'') | |||
|
211 | assert os.path.isfile(u'hello.txt') |
General Comments 0
You need to be logged in to leave comments.
Login now