From 5fbdea8983d7b978ae04e3fb75b4c1851db6bc71 Mon Sep 17 00:00:00 2001 From: Justin Poehnelt Date: Wed, 21 Aug 2019 16:36:57 -0700 Subject: [PATCH 1/3] upgrade to pytest and nox --- .gitignore | 5 ++--- .travis.yml | 20 +++++++++---------- README.md | 10 +++++----- noxfile.py | 45 +++++++++++++++++++++++++++++++++++++++++++ setup.cfg | 5 +++++ test_requirements.txt | 5 +++-- tox.ini | 16 --------------- 7 files changed, 70 insertions(+), 36 deletions(-) create mode 100644 noxfile.py create mode 100644 setup.cfg delete mode 100644 tox.ini diff --git a/.gitignore b/.gitignore index 78c58e12..0d2efbbc 100644 --- a/.gitignore +++ b/.gitignore @@ -28,9 +28,8 @@ dist/ # python testing things etc .coverage -.tox +.nox env -nosetests.xml googlemaps.egg-info *.egg - +.vscode/ diff --git a/.travis.yml b/.travis.yml index ea1fa63d..8bac1153 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,16 +1,16 @@ +dist: xenial + language: python -matrix: - include: - - { python: '2.7', env: TOXENV=py27 } - - { python: '3.4', env: TOXENV=py34 } - - { python: '3.5', env: TOXENV=py35 } - - { python: '3.6', env: TOXENV=py36 } - - { python: '3.6', env: TOXENV=docs } +python: + - '2.7' + - '3.4' + - '3.5' + - '3.6' + - '3.7' install: - - pip install requests - - pip install tox + - pip install nox script: - - tox + - nox diff --git a/README.md b/README.md index e9a2e9c7..8418a52d 100644 --- a/README.md +++ b/README.md @@ -162,14 +162,14 @@ instead of an API key. ## Building the Project - # Installing tox - $ pip install tox + # Installing nox + $ pip install nox # Running tests - $ tox + $ nox # Generating documentation - $ tox -e docs + $ nox -e docs # Uploading a new release $ easy_install wheel twine @@ -177,7 +177,7 @@ instead of an API key. $ twine upload dist/* # Copy docs to gh-pages - $ tox -e docs && mv docs/_build/html generated_docs && git clean -Xdi && git checkout gh-pages + $ nox -e docs && mv docs/_build/html generated_docs && git clean -Xdi && git checkout gh-pages [apikey]: https://developers.google.com/maps/faq#keysystem diff --git a/noxfile.py b/noxfile.py new file mode 100644 index 00000000..db1cf592 --- /dev/null +++ b/noxfile.py @@ -0,0 +1,45 @@ +import nox + + +def _install_dev_packages(session): + session.install("-e", ".") + + +def _install_test_dependencies(session): + session.install("-r", "test_requirements.txt") + + +def _install_doc_dependencies(session): + session.install("sphinx") + + +@nox.session(python=["2.7", "3.5", "3.5", "3.6"]) +def tests(session): + _install_dev_packages(session) + _install_test_dependencies(session) + + session.install("pytest") + session.run("pytest") + + +@nox.session(python="2.7") +def docs(session): + _install_dev_packages(session) + _install_doc_dependencies(session) + + session.run("rm", "-rf", "docs/_build", external=True) + + sphinx_args = [ + "-a", + "-E", + "-b", + "html", + "-d", + "docs/_build/doctrees", + "docs", + "docs/_build/html", + ] + + sphinx_cmd = "sphinx-build" + + session.run(sphinx_cmd, *sphinx_args) diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 00000000..4adabc56 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,5 @@ +[tool:pytest] +addopts = -rsxX + +[flake8] +max-line-length = 120 \ No newline at end of file diff --git a/test_requirements.txt b/test_requirements.txt index 5646081a..abb885be 100644 --- a/test_requirements.txt +++ b/test_requirements.txt @@ -1,2 +1,3 @@ -nose -responses==0.3 +pytest +responses +mock diff --git a/tox.ini b/tox.ini deleted file mode 100644 index 77ca5b7e..00000000 --- a/tox.ini +++ /dev/null @@ -1,16 +0,0 @@ -[tox] -envlist = - py27,py32,py34,py35,py36,docs - -[testenv] -commands = - nosetests googlemaps/test -deps = -rtest_requirements.txt - -[testenv:docs] -basepython = - python2.7 -commands = - sphinx-build -a -E -b html -d docs/_build/doctrees docs docs/_build/html -deps = - Sphinx From 72d40f9324a3133eb32732266fedc90f7c644090 Mon Sep 17 00:00:00 2001 From: Justin Poehnelt Date: Wed, 21 Aug 2019 16:50:45 -0700 Subject: [PATCH 2/3] fix travis file --- .travis.yml | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8bac1153..c6cce172 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,16 +1,20 @@ -dist: xenial - language: python - -python: - - '2.7' - - '3.4' - - '3.5' - - '3.6' - - '3.7' - +matrix: + include: + - python: '2.7' + env: NOXSESSION="tests-2.7" + - python: '3.4' + env: NOXSESSION="tests-3.4" + - python: '3.5' + env: NOXSESSION="tests-3.5" + - python: '3.6' + env: NOXSESSION="tests-3.6" + - python: '3.7' + env: NOXSESSION="tests-3.7" + dist: xenial # required for Python 3.7 (github.com/travis-ci/travis-ci#9069) + sudo: required # required for Python 3.7 (github.com/travis-ci/travis-ci#9069) + - python: '2.7' + env: NOXSESSION="docs" install: - - pip install nox - -script: - - nox +- pip install nox +script: nox --session "$NOXSESSION" From e851693c62b5ceb4e63c591359af4a0011456cbb Mon Sep 17 00:00:00 2001 From: Justin Poehnelt Date: Wed, 21 Aug 2019 17:12:07 -0700 Subject: [PATCH 3/3] run nox in python3 --- .travis.yml | 12 +++++++----- .travis/install.sh | 11 +++++++++++ noxfile.py | 2 +- setup.cfg | 3 --- 4 files changed, 19 insertions(+), 9 deletions(-) create mode 100755 .travis/install.sh diff --git a/.travis.yml b/.travis.yml index c6cce172..87a0fece 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,20 +1,22 @@ language: python +dist: xenial + matrix: include: - python: '2.7' env: NOXSESSION="tests-2.7" - - python: '3.4' - env: NOXSESSION="tests-3.4" - python: '3.5' env: NOXSESSION="tests-3.5" - python: '3.6' env: NOXSESSION="tests-3.6" - python: '3.7' env: NOXSESSION="tests-3.7" - dist: xenial # required for Python 3.7 (github.com/travis-ci/travis-ci#9069) sudo: required # required for Python 3.7 (github.com/travis-ci/travis-ci#9069) - python: '2.7' env: NOXSESSION="docs" + install: -- pip install nox -script: nox --session "$NOXSESSION" +- ./.travis/install.sh + +script: +- python3 -m nox --session "$NOXSESSION" diff --git a/.travis/install.sh b/.travis/install.sh new file mode 100755 index 00000000..9dd84bde --- /dev/null +++ b/.travis/install.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +set -exo pipefail + +if ! python3 -m pip --version; then + curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py + sudo python3 get-pip.py + sudo python3 -m pip install nox +else + python3 -m pip install nox +fi diff --git a/noxfile.py b/noxfile.py index db1cf592..528d834b 100644 --- a/noxfile.py +++ b/noxfile.py @@ -13,7 +13,7 @@ def _install_doc_dependencies(session): session.install("sphinx") -@nox.session(python=["2.7", "3.5", "3.5", "3.6"]) +@nox.session(python=["2.7", "3.5", "3.6", "3.7"]) def tests(session): _install_dev_packages(session) _install_test_dependencies(session) diff --git a/setup.cfg b/setup.cfg index 4adabc56..53e6e1cb 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,5 +1,2 @@ [tool:pytest] addopts = -rsxX - -[flake8] -max-line-length = 120 \ No newline at end of file