Class PythonSyntaxTest
- java.lang.Object
-
- de.iip_ecosphere.platform.services.environment.PythonSyntaxTest
-
public class PythonSyntaxTest extends java.lang.ObjectPerforms a python syntax test.- Author:
- Alexander Weber
-
-
Field Summary
Fields Modifier and Type Field Description private static booleanpyflakesExistsIf pyflakes is installed, assumed to be true.private static java.util.List<java.io.File>pythonFiles
-
Constructor Summary
Constructors Constructor Description PythonSyntaxTest()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidgetAllPythonServices(java.lang.String directory)Give a list of files in a directory.static voidmain(java.lang.String[] args)Runs a python command on CLI to evaluate the python service script on build time.static java.lang.StringreadProcessOutput(java.io.InputStream stream)Shall take in input stream of processes to collect console output.static java.lang.StringrunPythonTest(java.lang.String[] cmd)Running the syntax check for the python Files.
-
-
-
Method Detail
-
main
public static void main(java.lang.String[] args) throws java.util.concurrent.ExecutionExceptionRuns a python command on CLI to evaluate the python service script on build time.- Parameters:
args- Args. No used.- Throws:
java.util.concurrent.ExecutionException- In case the Python file is not well build
-
runPythonTest
public static java.lang.String runPythonTest(java.lang.String[] cmd)
Running the syntax check for the python Files.- Parameters:
cmd- the command to run, either utilising pyflaks or py_compile- Returns:
- The output to add to the other outputs
-
readProcessOutput
public static java.lang.String readProcessOutput(java.io.InputStream stream) throws java.io.IOExceptionShall take in input stream of processes to collect console output.- Parameters:
stream- Process to be observed.- Returns:
- The read Lines from the process.
- Throws:
java.io.IOException- If the reading of the lines does fail.
-
getAllPythonServices
public static void getAllPythonServices(java.lang.String directory)
Give a list of files in a directory.- Parameters:
directory- the path to the directory as String.
-
-