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:43 UTC

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

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/18e3d64c/gremlin-python/src/main/jython/setup.cfg
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/jython/setup.cfg b/gremlin-python/src/main/jython/setup.cfg
index de959fe..f8bab76 100644
--- a/gremlin-python/src/main/jython/setup.cfg
+++ b/gremlin-python/src/main/jython/setup.cfg
@@ -15,4 +15,7 @@
 # specific language governing permissions and limitations
 # under the License.
 [bdist_wheel]
-universal=1
\ No newline at end of file
+universal=1
+
+[pytest]
+addopts = --junitxml=../python-reports/TEST-native-python.xml
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/18e3d64c/gremlin-python/src/main/jython/setup.py
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/jython/setup.py b/gremlin-python/src/main/jython/setup.py
index 01521ed..528e69b 100644
--- a/gremlin-python/src/main/jython/setup.py
+++ b/gremlin-python/src/main/jython/setup.py
@@ -19,7 +19,7 @@ under the License.
 import codecs
 import os
 import time
-from setuptools import setup
+from setuptools import setup, Command
 
 # Folder containing the setup.py
 root = os.path.dirname(os.path.abspath(__file__))
@@ -43,14 +43,27 @@ import __version__
 
 version = __version__.version
 
+class PyTest(Command):
+    user_options = []
+    def initialize_options(self):
+        pass
+    def finalize_options(self):
+        pass
+    def run(self):
+        import sys,subprocess
+        errno = subprocess.call([sys.executable, 'runtest.py'])
+        raise SystemExit(errno)
+
 setup(
     name='gremlinpython',
     version=version,
-    packages=['gremlin_python', 'gremlin_python.driver', 'gremlin_python.process', 'gremlin_python.structure', 'gremlin_python.structure.io'],
+    packages=['gremlin_python', 'gremlin_python.driver', 'gremlin_python.process', 'gremlin_python.structure', 'gremlin_python.structure.io', 'tests'],
     license='Apache 2',
     url='http://tinkerpop.apache.org',
     description='Gremlin-Python for Apache TinkerPop',
     long_description=open("README").read(),
+    test_suite="tests",
+    cmdclass = {'test': PyTest},
     install_requires=[
         'aenum',
         'requests',

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/18e3d64c/gremlin-python/src/main/jython/tests/test_sample.py
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/jython/tests/test_sample.py b/gremlin-python/src/main/jython/tests/test_sample.py
new file mode 100644
index 0000000..f362317
--- /dev/null
+++ b/gremlin-python/src/main/jython/tests/test_sample.py
@@ -0,0 +1,25 @@
+'''
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+'''
+import unittest
+
+def fun(x):
+    return x + 1
+
+def test_answer():
+    assert fun(3) == 4
\ No newline at end of file