From e09c2c76f3f7bdac6d10142c439984bc3cddce25 Mon Sep 17 00:00:00 2001 From: Andy Chosak Date: Fri, 29 Mar 2019 13:45:24 -0400 Subject: [PATCH] Add Python 3 support This change adds support for running this project with Python 3.6. It adds a new configuration to tox that runs tests against Python 3. It also modifies the Travis release script so that built wheels are universal (Python 2 and 3). --- .coveragerc | 11 +++++++++++ .travis.yml | 9 +++++---- setup.py | 1 + tox.ini | 12 +++++++++--- 4 files changed, 26 insertions(+), 7 deletions(-) create mode 100644 .coveragerc diff --git a/.coveragerc b/.coveragerc new file mode 100644 index 000000000..bcdaf5abe --- /dev/null +++ b/.coveragerc @@ -0,0 +1,11 @@ +[run] +source = + ccdb5_ui + +omit = + */wsgi.py + +[report] +exclude_lines = + pragma: no cover + if __name__ == .__main__.: diff --git a/.travis.yml b/.travis.yml index a0c45ed13..be108c52e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,9 +1,10 @@ --- -language: node_js +language: python python: - - "2.7" + - 2.7 + - 3.6 install: - - pip install --user tox + - pip install tox-travis script: # The tox tests run the frontend build so no manual npm install is needed. - tox @@ -11,7 +12,7 @@ script: # We don't want changes to package-lock.json to show up as local git # changes when the Python wheel tag is determined. - git checkout package-lock.json - - python setup.py bdist_wheel + - python setup.py bdist_wheel --universal after_script: - cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js deploy: diff --git a/setup.py b/setup.py index 5e7758e07..b53f69561 100644 --- a/setup.py +++ b/setup.py @@ -32,6 +32,7 @@ def read_file(filename): 'Intended Audience :: Developers', 'Programming Language :: Python', 'Programming Language :: Python :: 2.7', + 'Programming Language :: Python :: 3.6', 'Framework :: Django', 'Development Status :: 4 - Beta', 'Operating System :: OS Independent', diff --git a/tox.ini b/tox.ini index 69e6fc731..fd29ab082 100644 --- a/tox.ini +++ b/tox.ini @@ -1,11 +1,17 @@ [tox] skipsdist=True - -envlist=dj{111} +envlist=py{27,36}-dj{111} [testenv] install_command=pip install -e ".[testing]" -U {opts} {packages} -commands=coverage run ./manage.py test +commands= + coverage erase + coverage run ./manage.py test + coverage report --skip-covered + +basepython= + py27: python2.7 + py36: python3.6 deps= coverage==4.5.1