<s> """<STR_LIT>""" <EOL> import sys <EOL> from unittest import TestCase <EOL> import nose . tools as nt <EOL> from IPython . utils . process import ( find_cmd , FindCmdError , arg_split , <EOL> system , getoutput , getoutputerror ) <EOL> from IPython . testing import decorators as dec <EOL> from IPython . testing import tools as tt <EOL> def test_find_cmd_python ( ) : <EOL> """<STR_LIT>""" <EOL> nt . assert_equals ( find_cmd ( '<STR_LIT>' ) , sys . executable ) <EOL> @ dec . skip_win32 <EOL> def test_find_cmd_ls ( ) : <EOL> """<STR_LIT>""" <EOL> path = find_cmd ( '<STR_LIT>' ) <EOL> nt . assert_true ( path . endswith ( '<STR_LIT>' ) ) <EOL> def has_pywin32 ( ) : <EOL> try : <EOL> import win32api <EOL> except ImportError : <EOL> return False <EOL> return True <EOL> @ dec . onlyif ( has_pywin32 , "<STR_LIT>" ) <EOL> def test_find_cmd_pythonw ( ) : <EOL> """<STR_LIT>""" <EOL> path = find_cmd ( '<STR_LIT>' ) <EOL> nt . assert_true ( path . endswith ( '<STR_LIT>' ) ) <EOL> @ dec . onlyif ( lambda : sys . platform != '<STR_LIT:win32>' or has_pywin32 ( ) , <EOL> "<STR_LIT>" ) <EOL> def test_find_cmd_fail ( ) : <EOL> """<STR_LIT>""" <EOL> nt . assert_raises ( FindCmdError , find_cmd , '<STR_LIT>' ) <EOL> def test_arg_split ( ) : <EOL> """<STR_LIT>""" <EOL> tests = [ [ '<STR_LIT>' , [ '<STR_LIT>' ] ] , <EOL> [ '<STR_LIT>' , [ '<STR_LIT>' ] ] , <EOL> [ '<STR_LIT>' , [ '<STR_LIT:hello>' , '<STR_LIT>' ] ] , <EOL> [ '<STR_LIT>' , [ '<STR_LIT>' ] ] , <EOL> [ '<STR_LIT>' , [ '<STR_LIT>' , '<STR_LIT>' ] ] , <EOL> ] <EOL> for argstr , argv in tests : <EOL> nt . assert_equal ( arg_split ( argstr ) , argv ) <EOL> class SubProcessTestCase ( TestCase , tt . TempFileMixin ) : <EOL> def setUp ( self ) : <EOL> """<STR_LIT>""" <EOL> lines = [ "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" ] <EOL> self . mktmp ( '<STR_LIT:\n>' . join ( lines ) ) <EOL> def test_system ( self ) : <EOL> system ( '<STR_LIT>' % self . fname ) <EOL> def test_getoutput ( self ) : <EOL> out = getoutput ( '<STR_LIT>' % self . fname ) <EOL> self . assertEquals ( out , '<STR_LIT>' ) <EOL> def test_getoutput ( self ) : <EOL> out , err = getoutputerror ( '<STR_LIT>' % self . fname ) <EOL> self . assertEquals ( out , '<STR_LIT>' ) <EOL> self . assertEquals ( err , '<STR_LIT>' ) </s>
