diff options
author | Bernat Gabor <jokerjokerer@gmail.com> | 2017-12-06 15:06:48 +0000 |
---|---|---|
committer | Bernat Gabor <jokerjokerer@gmail.com> | 2017-12-06 20:49:09 +0000 |
commit | 5199069386deb02da6e0e5217629925d27a46608 (patch) | |
tree | 59646a1f3a6fc7218ea10b86547b27700ac45904 | |
parent | 40581bbbced50fa3388d283721f3bfa847c1c202 (diff) | |
download | dateutil-5199069386deb02da6e0e5217629925d27a46608.tar.gz |
make the CI to use tox
- tox -e py27,py36,coverage allows you to merge and report coverage
files locally too
- tox without args will run all existing python tests and do coverage
report
- codecov is uploaded via a tox env (not ran by default)
-rw-r--r-- | .gitignore | 3 | ||||
-rw-r--r-- | .travis.yml | 25 | ||||
-rw-r--r-- | appveyor.yml | 60 | ||||
-rw-r--r-- | requirements-dev.txt | 10 | ||||
-rw-r--r-- | tox.ini | 53 |
5 files changed, 79 insertions, 72 deletions
@@ -12,3 +12,6 @@ docs/_build/ # Timezone information tzdata*.tar.gz + +.idea +.cache diff --git a/.travis.yml b/.travis.yml index ab16bc8..e512d3b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,7 +2,6 @@ language: python cache: pip python: - "2.7" - - "3.2" - "3.3" - "3.4" - "3.5" @@ -12,32 +11,18 @@ python: - "pypy3" matrix: + fast_finish: true allow_failures: - python: "nightly" -before_install: - # Install test dependencies - - pip install -r requirements-dev.txt - - pip install codecov - install: + - pip install -U six && pip install -U tox - ./ci_tools/retry.sh python updatezinfo.py - - if pip freeze | grep dateutil; then pip uninstall -y python-dateutil; fi - - # Install the libraries - - pip install . - -before_script: - # Run the script from something other than the repo root - - mkdir build_test - - cp -pr dateutil/test build_test/test - - cd build_test - script: - - coverage run -m pytest -v + - tox -e py after_success: - - codecov + - tox -e coverage,codecov -sudo: false +sudo: FALSE diff --git a/appveyor.yml b/appveyor.yml index 034bcc9..8abb7b0 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,48 +1,38 @@ build: false environment: matrix: - - PYTHON: "C:/Python27" - - PYTHON: "C:/Python27-x64" - - PYTHON: "C:/Python33" - - PYTHON: "C:/Python33-x64" - - PYTHON: "C:/Python34" - - PYTHON: "C:/Python34-x64" - - PYTHON: "C:/Python35" - - PYTHON: "C:/Python35-x64" - - PYTHON: "C:/Python36" - - PYTHON: "C:/Python36-x64" + - PYTHON_VERSION: 27 + - PYTHON_VERSION: 33 + - PYTHON_VERSION: 34 + - PYTHON_VERSION: 35 + - PYTHON_VERSION: 36 +platform: + - x86 + - x64 -install: - # Add PostgreSQL (zic), Python and scripts directory to current path - - set PATH=%PYTHON%;%PYTHON%/Scripts;c:\Program Files\PostgreSQL\9.3\bin\;%PATH% - - python --version +matrix: + fast_finish: true - # Not sure what the best way to get the Python minor version in a clear way - - set VERSION_CMD='python -c "import sys; print(\".\".join(map(str, sys.version_info[0:2])))"' - - for /f %%i in (%VERSION_CMD%) do set PYTHON_VERSION=%%i +install: + # set env variables + - set TOXENV=py%PYTHON_VERSION% + - if %PLATFORM% == "X64" (set PYTHON_PATH=C:\Python%PYTHON_VERSION%-x64) ELSE (set PYTHON_PATH=C:\Python%PYTHON_VERSION%) - # Download scripts and dependencies - - if %PYTHON_VERSION%==3.3 pip install "py<1.5.0" - - "pip install -r requirements-dev.txt" - - "pip install codecov" - - # If any of our dependencies installed python-dateutil, drop it - - pip uninstall -y python-dateutil && exit 0 - - pip install . + # Add PostgreSQL (zic), Python and scripts directory to current path + - set PATH=%PYTHON_PATH%;c:\Program Files\PostgreSQL\9.3\bin\;%PATH% + - set PYTHON=%PYTHON_PATH%/python.exe + - "%PYTHON% -c \"import sys; print(sys.executable, sys.version)\"" # This frequently fails with network errors, so we'll retry it up to 5 times # with a 1 minute rate limit. - - "ci_tools/retry.bat %PYTHON%/python.exe updatezinfo.py" + - "%PYTHON% -m pip install six" + - "ci_tools/retry.bat %PYTHON% updatezinfo.py" # This environment variable tells the test suite it's OK to mess with the time zone. - set DATEUTIL_MAY_CHANGE_TZ=1 -before_test: - - mkdir build_test - - mkdir build_test\\test - # All these options seem to be the equivalent of cp -pr - - xcopy dateutil\\test build_test\\test /E /H /K /O /X - - cd build_test + - C:\Python36\python -m pip install -U tox + test_script: - - "coverage run --source=dateutil -m pytest -v" + - C:\Python36\scripts\tox + after_test: - - "coverage report -m" - - "codecov" + - C:\Python36\scripts\tox -e coverage,codecov diff --git a/requirements-dev.txt b/requirements-dev.txt index 4a826cf..cf0d325 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,9 +1,7 @@ six -pytest >= 3.0 ; python_version != '3.2' and python_version != '3.3' -pytest < 3.3; python_version == '3.3' -pytest >= 2.0 ; python_version == '3.2' +pytest >= 3.0; python_version != '3.3' +pytest < 3.3; python_version == '3.3' +pytest-cov >= 2.0.0 freezegun -coverage==3.7.1 ; python_version == '3.2' -coverage ; python_version != '3.2' +coverage mock ; python_version < '3.0' - @@ -1,14 +1,45 @@ [tox] -envlist = - py27, - py32, - py33, - py34, - py35, - py36, - pypy, - pypy3 +envlist = py27, + py33, + py34, + py35, + py36, + pypy, + pypy3, + coverage +minversion = 2.7.0 +skip_missing_interpreters = true [testenv] -commands = pytest {posargs} -deps = -rrequirements-dev.txt
\ No newline at end of file +description = run the unit tests with pytest under {basepython} +setenv = COVERAGE_FILE={toxworkdir}/.coverage.{envname} +passenv = DATEUTIL_MAY_CHANGE_TZ TOXENV CI TRAVIS TRAVIS_* APPVEYOR APPVEYOR_* CODECOV_* +commands = python -m pytest {posargs: --cov-config="{toxinidir}/tox.ini" --cov=dateutil "{toxinidir}/dateutil/test"} +deps = -rrequirements-dev.txt + +[testenv:coverage] +description = combine coverage data and create reports +deps = coverage +skip_install = True +changedir = {toxworkdir} +setenv = COVERAGE_FILE=.coverage +commands = coverage erase + coverage combine + coverage report + coverage xml + +[testenv:codecov] +description = [only run on CI]: upload coverage data to codecov (depends on coverage running first) +deps = codecov +skip_install = True +commands = codecov --file {toxworkdir}/coverage.xml + +[testenv:dev] +description = DEV environment +usedevelop = True +commands = python -m pip list --format=columns + python -c 'import sys; print(sys.executable)' + +[coverage:run] +source = dateutil +omit = dateutil/test* |