コード例 #1
0
 public void testopenJythonShellOnCmdExe()
 {
     var process = JythonShell.openJythonShellOnCmdExe();
     Assert.That(process != null, "process was null");
     Assert.That(process.HasExited == false, "process.HasExited");
     Processes.Sleep(1000);
     process.Kill();
     process.WaitForExit();
     Assert.That(process.HasExited, "process should had exited by now");
 }
コード例 #2
0
        public void testJythonScriptExecution()
        {
            Assert.That(JythonInstall.checkJythonInstallation(), "checkJythonInstallation return false");
            Assert.That(JythonShell.testJython("print 2+3", "5"), "testJython failed");
            Assert.That(false == JythonShell.testJython("print 2+3", "4"), "testJython should had failed");

            var scriptToExecute = "print 2+3";
            var expectedDataReceived = "5" + Environment.NewLine;
            var tempPyScript = DI.config.getTempFileInTempDirectory("py");
            Files.WriteFileContent(tempPyScript, scriptToExecute);
            
            var dataReceived = new JythonShell().executePythonFile(tempPyScript, "");
            Assert.That(dataReceived == expectedDataReceived, "data received did no match expectedDataReceived");
            File.Delete(tempPyScript);
        }