You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by sp...@apache.org on 2016/08/27 00:54:45 UTC

[30/50] [abbrv] tinkerpop git commit: Add testing framework for native python based tests.

Add testing framework for native python based tests.


Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/18e3d64c
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/18e3d64c
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/18e3d64c

Branch: refs/heads/master
Commit: 18e3d64ca08c5f74d4aba4481deee5155cadd50c
Parents: e75ca23
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Aug 25 16:47:11 2016 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu Aug 25 16:47:11 2016 -0400

----------------------------------------------------------------------
 gremlin-python/pom.xml                          |   70 +-
 gremlin-python/src/main/jython/runtest.py       | 2892 ++++++++++++++++++
 gremlin-python/src/main/jython/setup.cfg        |    5 +-
 gremlin-python/src/main/jython/setup.py         |   17 +-
 .../src/main/jython/tests/test_sample.py        |   25 +
 5 files changed, 3002 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/18e3d64c/gremlin-python/pom.xml
----------------------------------------------------------------------
diff --git a/gremlin-python/pom.xml b/gremlin-python/pom.xml
index 3d45a07..9a6d75b 100644
--- a/gremlin-python/pom.xml
+++ b/gremlin-python/pom.xml
@@ -71,6 +71,11 @@
             <scope>test</scope>
         </dependency>
     </dependencies>
+    <properties>
+        <!-- provide a way to convert maven.test.skip value to skipTests for use in skipping python tests -->
+        <maven.test.skip>false</maven.test.skip>
+        <skipTests>${maven.test.skip}</skipTests>
+    </properties>
     <build>
         <directory>${basedir}/target</directory>
         <finalName>${project.artifactId}-${project.version}</finalName>
@@ -87,13 +92,33 @@
             </testResource>
         </testResources>
         <plugins>
+            <!-- need to create python-reports directory at this point or else pytest can't write the report to it -->
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-antrun-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>createThriftDir</id>
+                        <phase>process-resources</phase>
+                        <configuration>
+                            <tasks>
+                                <delete dir="${build.directory}/python-reports"/>
+                                <mkdir dir="${build.directory}/python-reports"/>
+                            </tasks>
+                        </configuration>
+                        <goals>
+                            <goal>run</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
             <plugin>
                 <groupId>org.codehaus.mojo</groupId>
                 <artifactId>exec-maven-plugin</artifactId>
                 <version>1.2.1</version>
                 <executions>
                     <execution>
-                        <id>generatePython</id>
+                        <id>generate-python</id>
                         <phase>generate-test-resources</phase>
                         <goals>
                             <goal>java</goal>
@@ -107,19 +132,56 @@
                         </configuration>
                     </execution>
                     <execution>
-                        <id>buildPython</id>
+                        <id>build-python</id>
                         <phase>generate-test-resources</phase>
                         <goals>
                             <goal>exec</goal>
                         </goals>
                         <configuration>
                             <executable>python</executable>
-                            <async>true</async>
-                            <workingDirectory>${basedir}/src/main/jython</workingDirectory>
+                            <workingDirectory>${basedir}/target/python</workingDirectory>
                             <commandlineArgs>setup.py build --build-lib ${project.build.testOutputDirectory}/Lib
                             </commandlineArgs>
                         </configuration>
                     </execution>
+                    <!-- use pytest to execute native python tests - output of xunit output is configured in setup.cfg -->
+                    <execution>
+                        <id>test-python</id>
+                        <phase>generate-test-resources</phase>
+                        <goals>
+                            <goal>exec</goal>
+                        </goals>
+                        <configuration>
+                            <executable>python</executable>
+                            <workingDirectory>${basedir}/target/python</workingDirectory>
+                            <skip>${skipTests}</skip>
+                            <arguments>
+                                <argument>setup.py</argument>
+                                <argument>test</argument>
+                            </arguments>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <artifactId>maven-resources-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>copy-py-files-to-target</id>
+                        <phase>process-resources</phase>
+                        <goals>
+                            <goal>copy-resources</goal>
+                        </goals>
+                        <configuration>
+                            <outputDirectory>${basedir}/target/python</outputDirectory>
+                            <resources>
+                                <resource>
+                                    <directory>${basedir}/src/main/jython</directory>
+                                    <filtering>true</filtering>
+                                </resource>
+                            </resources>
+                        </configuration>
+                    </execution>
                 </executions>
             </plugin>
             <plugin>