Esempio n. 1
0
 public void unInstallJython()
 {
     JythonInstall.uninstallJython();
     Assert.That(false == Directory.Exists(JythonConfig._jythonRuntimeDir),
                 "Jython Runtime directory should had been empty: {0}",
                 JythonConfig._jythonRuntimeDir);
 }
Esempio n. 2
0
 public void installJython()
 {
     if (Directory.Exists(JythonConfig._jythonRuntimeDir))
         unInstallJython();
     JythonInstall.installJython();
     Assert.That(Directory.Exists(JythonConfig._jythonRuntimeDir), "Could not find Jython Runtime directory: {0}",
                 JythonConfig._jythonRuntimeDir);
 }
Esempio n. 3
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);
        }