Skip to content

Commit

Permalink
Update travis test coverage: 2.7, 3.4, 3.7, pypy2.7 (#1614)
Browse files Browse the repository at this point in the history
* 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)
  • Loading branch information
jeffwidman authored and dpkp committed Mar 13, 2019
1 parent 994d283 commit c0add71
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 11 deletions.
11 changes: 7 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -18,21 +19,23 @@ addons:
apt:
packages:
- libsnappy-dev
- openjdk-8-jdk

cache:
directories:
- $HOME/.cache/pip
- servers/

before_install:
- source travis_java_install.sh
- ./build_integration.sh

install:
- pip install tox coveralls
- 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
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
2 changes: 1 addition & 1 deletion docs/compatibility.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ def run(cls):
"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",
]
Expand Down
6 changes: 3 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down
25 changes: 25 additions & 0 deletions travis_java_install.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit c0add71

Please sign in to comment.