##// END OF EJS Templates
Use default OS shell to run system commands...
Use default OS shell to run system commands Instead of using os.system which uses /bin/sh, this uses subprocess.call (the replacement of os.system) to run the command using the default shell of the OS. With this, one can use more advanced commands for bash, zsh, ksh, ... I do not have a win32 system to test this modification, so maybe line 2236 can also be changed like 2239.

File last commit:

r12037:9f1ca071
r12217:56bf2f98
Show More
base.py
52 lines | 2.2 KiB | text/x-python | PythonLexer
Jonathan Frederic
Added base transformers test class and added CSSHTMLHeaderTransformer tests
r12023 """
Module with utility functions for transformer tests
"""
#-----------------------------------------------------------------------------
# Copyright (c) 2013, the IPython Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
# Imports
#-----------------------------------------------------------------------------
from IPython.nbformat import current as nbformat
Jonathan Frederic
Added utility function to build a proper resources dict
r12031 from ...tests.base import TestsBase
from ...exporters.exporter import ResourcesDict
Jonathan Frederic
Added base transformers test class and added CSSHTMLHeaderTransformer tests
r12023 #-----------------------------------------------------------------------------
# Class
#-----------------------------------------------------------------------------
class TransformerTestsBase(TestsBase):
"""Contains test functions transformer tests"""
def build_notebook(self):
"""Build a notebook in memory for use with transformer tests"""
outputs = [nbformat.new_output(output_type="stream", stream="stdout", output_text="a"),
nbformat.new_output(output_type="text", output_text="b"),
nbformat.new_output(output_type="stream", stream="stdout", output_text="c"),
nbformat.new_output(output_type="stream", stream="stdout", output_text="d"),
nbformat.new_output(output_type="stream", stream="stderr", output_text="e"),
Jonathan Frederic
Added png output
r12027 nbformat.new_output(output_type="stream", stream="stderr", output_text="f"),
Jonathan Frederic
Attempt 2, fix py3 png encoding
r12037 nbformat.new_output(output_type="png", output_png=b'Zw==')] #g
Jonathan Frederic
Added base transformers test class and added CSSHTMLHeaderTransformer tests
r12023
Jonathan Frederic
Added latex transformer test
r12030 cells=[nbformat.new_code_cell(input="$ e $", prompt_number=1,outputs=outputs),
nbformat.new_text_cell('markdown', source="$ e $")]
Jonathan Frederic
Added base transformers test class and added CSSHTMLHeaderTransformer tests
r12023 worksheets = [nbformat.new_worksheet(name="worksheet1", cells=cells)]
return nbformat.new_notebook(name="notebook1", worksheets=worksheets)
Jonathan Frederic
Added utility function to build a proper resources dict
r12031
def build_resources(self):
"""Build an empty resources dictionary."""
res = ResourcesDict()
res['metadata'] = ResourcesDict()
return res