From 5d307e08381f38ee57af66d615125de8afa2e9d8 Mon Sep 17 00:00:00 2001 From: Jiri BOROVEC Date: Mon, 5 Aug 2019 21:22:18 +0200 Subject: [PATCH] use tox * update Travis * add Appveyor --- .travis.yml | 53 +++++++++++++++++++++++++++++++++--------- appveyor.yml | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++++ tox.ini | 50 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 157 insertions(+), 11 deletions(-) create mode 100644 appveyor.yml create mode 100644 tox.ini diff --git a/.travis.yml b/.travis.yml index d80b291f14..51b99f890c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,17 +1,48 @@ +# vim ft=yaml + +# After changing this file, check it on: +# http://yaml-online-parser.appspot.com/ + +# See doc/travis_notes.txt for some guidelines + +# this file is *not* meant to cover or endorse the use of travis, but rather to +# help confirm pull requests to this project. + +dist: xenial # Ubuntu 16.04 + +env: + global: + - DISPLAY="" + language: python -python: - - "3.7" -# command to install dependencies + +matrix: + include: + - python: 3.5 + env: TOXENV=py35 + - python: 3.6 + env: TOXENV=py36 + - python: 3.7 + env: TOXENV=py37 + +# See http://docs.travis-ci.com/user/caching/#pip-cache cache: pip + install: - - pip install -e . + - sudo apt-get install python-opencv openslide-tools - pip install -r requirements.txt - - pip install -r tests/requirements.txt - - pip install -U numpy + - pip install -r ./tests/requirements.txt + - pip install tox + - pip --version ; pip list -# keep build from timing out -dist: xenial - -# command to run tests script: - - py.test -v # or py.test for Python versions 3.5 and below \ No newline at end of file + # integration + - tox --sitepackages + - python setup.py install --user --dry-run + +after_success: + - coverage report + - codecov + +notifications: + email: false diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 0000000000..8e5e1414f2 --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,65 @@ +# https://www.appveyor.com/docs/appveyor-yml/ +environment: + + # SDK v7.0 MSVC Express 2008's SetEnv.cmd script will fail if the + # /E:ON and /V:ON options are not enabled in the batch script interpreter + # See: http://stackoverflow.com/a/13751649/163740 + CMD_IN_ENV: "cmd /E:ON /V:ON /C obvci_appveyor_python_build_env.cmd" + + matrix: + # Pre-installed Python versions, which Appveyor may upgrade to + # a later point release. + # See: http://www.appveyor.com/docs/installed-software#python + + + - PYTHON: "C:\\Python35-x64" + PYTHON_VERSION: "3.5.x" + PYTHON_ARCH: "64" + TOXENV: "py35" + + - PYTHON: "C:\\Python36-x64" + PYTHON_VERSION: "3.6.x" + PYTHON_ARCH: "64" + TOXENV: "py36" + + - PYTHON: "C:\\Python37-x64" + PYTHON_VERSION: "3.7.x" + PYTHON_ARCH: "64" + TOXENV: "py37" + +build: off + +# https://www.appveyor.com/docs/build-cache/ +cache: + - C:\ProgramData\chocolatey\bin -> appveyor.yml + - C:\ProgramData\chocolatey\lib -> appveyor.yml + - '%LOCALAPPDATA%\pip\Cache -> appveyor.yml' + +# scripts that run after cloning repository +install: + # If there is a newer build queued for the same PR, cancel this one. + # The AppVeyor 'rollout builds' option is supposed to serve the same + # purpose but it is problematic because it tends to cancel builds pushed + # directly to master instead of just PR builds (or the converse). + - choco upgrade chocolatey + - choco install -y opencv + - SET PATH=%PYTHON%;%PYTHON%\\Scripts;%path% + - pip install -U --user pip + - pip install -r requirements.txt + - pip install -r ./tests/requirements.txt + - pip install tox + +# scripts to run before tests (working directory and environment changes are persisted from the previous steps such as "before_build") +before_test: + - python --version + - pip --version + - pip list + - dir + +# to run your custom scripts instead of automatic tests +test_script: + - tox --sitepackages --parallel auto + +on_success: + - coverage report + - codecov diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000000..1c886cf8ce --- /dev/null +++ b/tox.ini @@ -0,0 +1,50 @@ +# this file is *not* meant to cover or endorse the use of tox or pytest or testing in general, +# +# It's meant to show the use of: +# +# - check-manifest +# confirm items checked into vcs are in your segdist +# - python setup.py check +# confirm required package meta-data in setup.py +# - readme_renderer (when using a ReStructuredText README) +# confirms your long_description will render correctly on PyPI. +# +# and also to help confirm pull requests to this project. + +[tox] +envlist = py{35,36,37} + +[pytest] +log_cli = 0 +log_cli_level = CRITICAL +log_cli_format = %(message)s +log_file = pytest.log +log_file_level = DEBUG +log_file_format = %(asctime)s [%(levelname)8s] %(message)s (%(filename)s:%(lineno)s) +log_file_date_format=%Y-%m-%d %H:%M:%S + +[testenv] +basepython = + py35: python3.5 + py36: python3.6 + py37: python3.7 +deps = + -r requirements.txt + -r ./tests/requirements.txt +commands = + check-manifest --ignore tox.ini + python setup.py check -m -s + coverage run --source pytorch_lightning -m py.test pytorch_lightning tests examples -v --doctest-modules + flake8 . + +[flake8] +exclude = .tox,*.egg,build,temp +select = E,W,F +doctests = True +verbose = 2 +# https://pep8.readthedocs.io/en/latest/intro.html#error-codes +ignore = + E402 + E501 +format = pylint +max-line-length = 100