Add tox for local development (no travis integration yet).

master
baztian 2017-03-08 14:32:22 +01:00
commit 460008e11e
8 changed files with 70 additions and 29 deletions

14
.gitignore vendored
View File

@ -1,8 +1,9 @@
*.pyc *.pyc
/README*.html /README*.html
*.class *.class
/build build/
/dist dist/
env/
.ropeproject/globalnames .ropeproject/globalnames
.ropeproject/history .ropeproject/history
.ropeproject/objectdb .ropeproject/objectdb
@ -11,6 +12,9 @@
mem.* mem.*
*.log *.log
JayDeBeApi.egg-info JayDeBeApi.egg-info
/mockdriver/target target/
/mockdriver/.classpath .classpath
/mockdriver/.project .project
.tox
*.iml
.idea/

View File

@ -37,8 +37,8 @@ before_install:
- ci/before_install.sh - ci/before_install.sh
install: install:
- if [ "$JDBC_DRIVER" == "org.jaydebeapi:mockdriver:1.0-SNAPSHOT" ]; then (cd mockdriver && mvn install) ;fi - if [ "$JDBC_DRIVER" == "org.jaydebeapi:mockdriver:1.0-SNAPSHOT" ]; then (cd mockdriver && mvn -Dmaven.repo.local=$VIRTUAL_ENV/.m2/repository install) ;fi
- if [ -n "$JDBC_DRIVER" ]; then envsubst < ci/dot_jip > $VIRTUAL_ENV/.jip && pip install jip==0.9.3 && jip install $JDBC_DRIVER && export CLASSPATH=$VIRTUAL_ENV/javalib/* ;fi # TODO: Fix jip to search for local maven repo without twaking .jip - if [ -n "$JDBC_DRIVER" ]; then python ci/jipconf_subst.py $VIRTUAL_ENV $VIRTUAL_ENV && pip install jip==0.9.9 && jip install $JDBC_DRIVER && export CLASSPATH=$VIRTUAL_ENV/javalib/* ;fi # TODO: Fix jip to search for local maven repo without twaking .jip
- source $HOME/myvirtualenv/bin/activate - source $HOME/myvirtualenv/bin/activate
- pip install -e . - pip install -e .
- if [ -z "$JYTHON" ]; then pip install coveralls ;fi - if [ -z "$JYTHON" ]; then pip install coveralls ;fi

View File

@ -10,19 +10,23 @@ Setup test requirements
======================= =======================
:: ::
sudo apt-get install python2.7-dev g++ maven sudo apt-get install python2.7-dev python3-dev python3-venv g++ maven
cd mockdriver cd <JAYDEBEAPI_WORKDIR>
mvn install python3 -m venv env
. env/bin/activate
pip install -rdev-requirements.txt
virtualenv ~/.virtualenvs/jaydebeapi-py27 -p /usr/bin/python2.7 # Install Jython 2.7
. ~/.virtualenvs/jaydebeapi-py27/bin/activate ci/mvnget.sh org.python:jython-installer:2.7.0
pip install -r dev-requirements.txt -r requirements-python-2.7.txt jip==0.9.9 java -jar jython-installer-2.7.0.jar && rm jython-installer-2.7.0.jar
envsubst < ci/dot_jip > $VIRTUAL_ENV/.jip # add jython to your path
jip install org.jaydebeapi:mockdriver:1.0-SNAPSHOT
jip install org.hsqldb:hsqldb:1.8.0.10 # run tests for all supported envs
jip install org.xerial:sqlite-jdbc:3.7.2 tox
# activate and work on specific env
. .tox/py35-driver-mock/bin/activate
export CLASSPATH=$VIRTUAL_ENV/javalib/* export CLASSPATH=$VIRTUAL_ENV/javalib/*
python setup.py develop
python test/testsuite.py python test/testsuite.py
Build a new release Build a new release
@ -50,7 +54,7 @@ Build a new release
7. Run setuptools to ensure everything is working as expected. :: 7. Run setuptools to ensure everything is working as expected. ::
$ python setup.py sdist bdist_wheel upload $ python setup.py sdist bdist_wheel upload -r pypitest
8. Check the files in ``dist/`` for unwanted or missing files. 8. Check the files in ``dist/`` for unwanted or missing files.

View File

@ -1,7 +0,0 @@
[repos:local]
uri=$HOME/.m2/repository/
type=local
[repos:central]
uri=http://repo1.maven.org/maven2/
type=remote

View File

@ -0,0 +1,16 @@
#!/usr/bin/env python
from __future__ import print_function
from os import path
import sys
home=sys.argv[1]
dist=sys.argv[2]
with open(path.join(home, '.jip_config'), "w") as out:
print("""[repos:local]
uri={0}/.m2/repository/
type=local
[repos:central]
uri=http://repo1.maven.org/maven2/
type=remote
""".format(dist), file=out)

View File

@ -4,7 +4,7 @@ set -e
ARTIFACT_SPEC=$1 ARTIFACT_SPEC=$1
GROUP_ID=${ARTIFACT_SPEC%%:*} GROUP_ID=${ARTIFACT_SPEC%%:*}
NON_GROUP_ID=${ARTIFACT_SPEC#*:} NON_GROUP_ID=${ARTIFACT_SPEC#*:}
ARTIFACT_NAME=`python -c "import re;print re.search(r':(.*):', '$ARTIFACT_SPEC').group(1)"` ARTIFACT_NAME=`python -c "import re;print(re.search(r':(.*):', '$ARTIFACT_SPEC').group(1))"`
_PATH=${GROUP_ID/./\/}/$ARTIFACT_NAME _PATH=${GROUP_ID/./\/}/$ARTIFACT_NAME
_ARTIFACT_SPEC_BASENAME=${NON_GROUP_ID/:/-} _ARTIFACT_SPEC_BASENAME=${NON_GROUP_ID/:/-}
VERSION=${ARTIFACT_SPEC##*:} VERSION=${ARTIFACT_SPEC##*:}

View File

@ -1,2 +1,3 @@
wheel==0.24.0 tox==2.6.0
bumpversion==0.5.1 wheel==0.29.0
bumpversion==0.5.3

23
tox.ini 100644
View File

@ -0,0 +1,23 @@
[tox]
envlist = py{26,27,3}-driver-{hsqldb,mock,sqliteXerial},py27-driver-sqlitePy,jython-driver-{hsqldb,mock}
[testenv]
whitelist_externals = mvn
setenv = CLASSPATH = {envdir}/javalib/*
driver-mock: TESTNAME=test_mock
driver-hsqldb: TESTNAME=test_integration.HsqldbTest
driver-sqliteXerial: TESTNAME=test_integration.SqliteXerialTest
driver-sqlitePy: TESTNAME=test_integration.SqlitePyTest
deps =
py26: -rrequirements-python-2.6.txt
py27: -rrequirements-python-2.7.txt
py3: -rrequirements-python-3.4.txt
# not required for jython >= 2.7 anymore jython: -rrequirements-jython.txt
jip==0.9.9
commands =
python ci/jipconf_subst.py {envdir} {toxworkdir}/shared
driver-hsqldb: jip install org.hsqldb:hsqldb:1.8.0.10
driver-sqliteXerial: jip install org.xerial:sqlite-jdbc:3.7.2
driver-mock: mvn -Dmaven.repo.local={toxworkdir}/shared/.m2/repository -f mockdriver/pom.xml install
driver-mock: jip install org.jaydebeapi:mockdriver:1.0-SNAPSHOT
{envbindir}/python test/testsuite.py {env:TESTNAME}
driver-hsqldb: {envbindir}/python test/doctests.py