From c0add71e8d656691c0dd2dcb1936953f4483285b Mon Sep 17 00:00:00 2001 From: Jeff Widman Date: Tue, 12 Mar 2019 22:01:11 -0700 Subject: Update travis test coverage: 2.7, 3.4, 3.7, pypy2.7 (#1614) * Use xenial dist for travis builds * Use openjdk8 for all travis tests * Update python build matrix -- add 3.7, drop 3.5/3.6 (keep 2.7, 3.4, pypy2.7) --- .travis.yml | 11 +++++++---- Makefile | 6 +++--- docs/compatibility.rst | 2 +- setup.py | 1 + tox.ini | 6 +++--- travis_java_install.sh | 25 +++++++++++++++++++++++++ 6 files changed, 40 insertions(+), 11 deletions(-) create mode 100644 travis_java_install.sh diff --git a/.travis.yml b/.travis.yml index fd6018b..cdb9339 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,11 +1,12 @@ language: python +dist: xenial + python: - 2.7 - 3.4 - - 3.5 - - 3.6 - - pypy + - 3.7 + - pypy2.7-6.0 env: - KAFKA_VERSION=0.8.2.2 @@ -18,6 +19,7 @@ addons: apt: packages: - libsnappy-dev + - openjdk-8-jdk cache: directories: @@ -25,6 +27,7 @@ cache: - servers/ before_install: + - source travis_java_install.sh - ./build_integration.sh install: @@ -32,7 +35,7 @@ install: - pip install . script: - - tox -e `if [ "$TRAVIS_PYTHON_VERSION" == "pypy" ]; then echo pypy; else echo py${TRAVIS_PYTHON_VERSION/./}; fi` + - tox -e `if [ "$TRAVIS_PYTHON_VERSION" == "pypy2.7-6.0" ]; then echo pypy; else echo py${TRAVIS_PYTHON_VERSION/./}; fi` after_success: - coveralls diff --git a/Makefile b/Makefile index 7dfd305..b4dcbff 100644 --- a/Makefile +++ b/Makefile @@ -14,8 +14,8 @@ servers/$(KAFKA_VERSION)/kafka-bin: build-integration: servers/$(KAFKA_VERSION)/kafka-bin # Test and produce coverage using tox. This is the same as is run on Travis -test36: build-integration - KAFKA_VERSION=$(KAFKA_VERSION) SCALA_VERSION=$(SCALA_VERSION) tox -e py36 -- $(FLAGS) +test37: build-integration + KAFKA_VERSION=$(KAFKA_VERSION) SCALA_VERSION=$(SCALA_VERSION) tox -e py37 -- $(FLAGS) test27: build-integration KAFKA_VERSION=$(KAFKA_VERSION) SCALA_VERSION=$(SCALA_VERSION) tox -e py27 -- $(FLAGS) @@ -56,4 +56,4 @@ doc: make -C docs html @echo "open file://`pwd`/docs/_build/html/index.html" -.PHONY: all test36 test27 test-local cov-local clean doc +.PHONY: all test37 test27 test-local cov-local clean doc diff --git a/docs/compatibility.rst b/docs/compatibility.rst index 85b2c59..ce222ee 100644 --- a/docs/compatibility.rst +++ b/docs/compatibility.rst @@ -12,6 +12,6 @@ through 0.8.0 . kafka-python is not compatible with the 0.8.2-beta release. Because the kafka server protocol is backwards compatible, kafka-python is expected to work with newer broker releases as well (2.0+). -kafka-python is tested on python 2.7, 3.4, 3.5, 3.6 and pypy. +kafka-python is tested on python 2.7, 3.4, 3.5, 3.6, 3.7, and pypy. Builds and tests via Travis-CI. See https://travis-ci.org/dpkp/kafka-python diff --git a/setup.py b/setup.py index 9dcdb8e..779adb9 100644 --- a/setup.py +++ b/setup.py @@ -57,6 +57,7 @@ setup( "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7", "Programming Language :: Python :: Implementation :: PyPy", "Topic :: Software Development :: Libraries :: Python Modules", ] diff --git a/tox.ini b/tox.ini index 1da88f3..48a143e 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py{26,27,34,35,36,py}, docs +envlist = py{26,27,34,35,36,37,py}, docs [pytest] testpaths = kafka test @@ -11,8 +11,8 @@ log_format = %(created)f %(filename)-23s %(threadName)s %(message)s deps = pytest<4.0 pytest-cov - py{27,34,35,36,py}: pylint - py{27,34,35,36,py}: pytest-pylint + py{27,34,35,36,37,py}: pylint + py{27,34,35,36,37,py}: pytest-pylint pytest-mock mock python-snappy diff --git a/travis_java_install.sh b/travis_java_install.sh new file mode 100644 index 0000000..f662ce2 --- /dev/null +++ b/travis_java_install.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +# borrowed from: https://github.com/mansenfranzen/pywrangler/blob/master/tests/travis_java_install.sh + +# Kafka requires Java 8 in order to work properly. However, TravisCI's Ubuntu +# 16.04 ships with Java 11 and Java can't be set with `jdk` when python is +# selected as language. Ubuntu 14.04 does not work due to missing python 3.7 +# support on TravisCI which does have Java 8 as default. + +# show current JAVA_HOME and java version +echo "Current JAVA_HOME: $JAVA_HOME" +echo "Current java -version:" +which java +java -version + +echo "Updating JAVA_HOME" +# change JAVA_HOME to Java 8 +export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-amd64 + +echo "Updating PATH" +export PATH=${PATH/\/usr\/local\/lib\/jvm\/openjdk11\/bin/$JAVA_HOME\/bin} + +echo "New java -version" +which java +java -version -- cgit v1.2.1