From: Kevin J. B. <kev...@us...> - 2003-07-31 08:32:55
|
Update of /cvsroot/jython/jython/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv28629/test Modified Files: test_javashell.py Log Message: Move LazyDict.py into javaos, remove test log messages Index: test_javashell.py =================================================================== RCS file: /cvsroot/jython/jython/Lib/test/test_javashell.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** test_javashell.py 31 Jul 2003 07:07:58 -0000 1.2 --- test_javashell.py 31 Jul 2003 08:32:49 -0000 1.3 *************** *** 18,21 **** --- 18,29 ---- ] + # turn off output from javashell.__warn + javashell.__warn = lambda *args: None + + def dprint( *args ): + #print args + pass + + # can instead set testCmds = fullTestCmds *************** *** 28,32 **** fullTestCmds = [ # no quotes, should output both words ! ("echo hello there", "hello there"), # should print PATH (on NT) ("echo PATH=%PATH%", "(PATH=.*;.*)|(PATH=%PATH%)"), --- 36,40 ---- fullTestCmds = [ # no quotes, should output both words ! ("echo hello world", "hello world"), # should print PATH (on NT) ("echo PATH=%PATH%", "(PATH=.*;.*)|(PATH=%PATH%)"), *************** *** 53,58 **** ] - testCmds = fullTestCmds - class JavaShellTest(unittest.TestCase): """This test validates the subshell functionality (javashell, os.environ, popen*). --- 61,64 ---- *************** *** 83,92 **** """ for cmd, pattern in testCmds: ! print "\nExecuting '%s' with %s environment" % (cmd, whichEnv) p = javashell.shellexecute(cmd) line = PyFile( p.getInputStream() ).readlines()[0] assert re.match( pattern, line ), \ "expected match for %s, got %s" % ( pattern, line ) ! print "waiting for", cmd, "to complete" assert not p.waitFor(), \ "%s failed with %s environment" % (cmd, whichEnv) --- 89,98 ---- """ for cmd, pattern in testCmds: ! dprint( "\nExecuting '%s' with %s environment" % (cmd, whichEnv)) p = javashell.shellexecute(cmd) line = PyFile( p.getInputStream() ).readlines()[0] assert re.match( pattern, line ), \ "expected match for %s, got %s" % ( pattern, line ) ! dprint( "waiting for", cmd, "to complete") assert not p.waitFor(), \ "%s failed with %s environment" % (cmd, whichEnv) *************** *** 129,146 **** def testBadShell( self ): "Attempting to get an environment with a shell that is not startable" ! print "testBadShell: ignore warnings about failing to get environment" se2 = javashell._ShellEnv( ["badshell", "-c"], "set" ) str(se2.environment) # trigger initialization assert not se2.environment.items(), "environment should be empty" ! print "end testBadShell" def testBadGetEnv( self ): "Attempting to get an environment with a command that does not print an environment" ! print "testBadGetEnv: ignore warnings about command not printing environment" envCmd="echo This command does not print environment" se2 = javashell._ShellEnv( javashell._shellEnv.cmd, envCmd, None ) str(se2.environment) # trigger initialization assert not se2.environment.items(), "environment should be empty" ! print "end testBadGetEnv" def testPutEnv( self ): --- 135,152 ---- def testBadShell( self ): "Attempting to get an environment with a shell that is not startable" ! dprint( "testBadShell: ignore warnings about failing to get environment") se2 = javashell._ShellEnv( ["badshell", "-c"], "set" ) str(se2.environment) # trigger initialization assert not se2.environment.items(), "environment should be empty" ! dprint( "end testBadShell") def testBadGetEnv( self ): "Attempting to get an environment with a command that does not print an environment" ! dprint( "testBadGetEnv: ignore warnings about command not printing environment") envCmd="echo This command does not print environment" se2 = javashell._ShellEnv( javashell._shellEnv.cmd, envCmd, None ) str(se2.environment) # trigger initialization assert not se2.environment.items(), "environment should be empty" ! dprint( "end testBadGetEnv") def testPutEnv( self ): |