Class PythonTestMojo

java.lang.Object
org.apache.maven.plugin.AbstractMojo
de.iip_ecosphere.platform.tools.maven.python.PythonTestMojo
All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo

@Mojo(name="test-python", defaultPhase=TEST) public class PythonTestMojo extends org.apache.maven.plugin.AbstractMojo
Maven Mojo for Python unit tests.
Author:
Alexander Weber, SSE, Holger Eichelberger, SSE
  • Field Details

    • project

      @Parameter(defaultValue="${project}", required=true, readonly=true) private org.apache.maven.project.MavenProject project
    • failOnError

      @Parameter(property="python-test.failOnError", defaultValue="true") private boolean failOnError
    • modelProject

      @Parameter(property="python-test.modelProject", defaultValue="../../../target/pySrc") private String modelProject
    • surefireSkip

      @Parameter(property="skipTests", required=false, defaultValue="false") private boolean surefireSkip
    • mavenSkip

      @Parameter(property="maven.test.skip", required=false, defaultValue="false") private boolean mavenSkip
    • skip

      @Parameter(property="python-test.skip", required=false, defaultValue="false") private boolean skip
    • test

      @Parameter(property="python-test.test", required=false, defaultValue="") private String test
    • python

      @Parameter(property="python.binary", required=false, defaultValue="") private String python
    • pythonPath

      @Parameter(property="python.pythonpath", required=false, defaultValue="") private String pythonPath
    • fileset

      @Parameter(required=false) private org.apache.maven.shared.model.fileset.FileSet fileset
      A specific fileSet rule to select files and directories.
    • testedFileCount

      private int testedFileCount
  • Constructor Details

    • PythonTestMojo

      public PythonTestMojo()
  • Method Details

    • setTest

      public void setTest(String test)
      Modify the test file. [testing]
      Parameters:
      test - the test file
    • getTestedFileCount

      public int getTestedFileCount(boolean reset)
      Returns the number of tested files.
      Parameters:
      reset - shall the number be reset
      Returns:
      the number of tested files
    • execute

      public void execute() throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException
      Throws:
      org.apache.maven.plugin.MojoExecutionException
      org.apache.maven.plugin.MojoFailureException
    • composeEnvironment

      private String[] composeEnvironment()
      Composes the environment for the python exec call.
      Returns:
      the environment, my be null for none
    • runPythonTest

      private String runPythonTest(String[] cmd, String workingDirectory, String[] envp)
      Running the syntax check for the python Files.
      Parameters:
      cmd - the command to run, shall run a python file
      workingDirectory - the directory of the python tests
      Returns:
      The output to add to the other outputs
    • add

      private static void add(List<String> paths, String path)
      Adds a path given with slashes to paths as OS-specific path.
      Parameters:
      paths - the paths list to be modified
      path - the path to be added