Test with coverage on Windows, update 'setup.py test'

This commit is contained in:
Hugo 2017-10-29 15:11:00 +02:00 committed by wiredfool
parent db760c1284
commit 3515ae3d9e
9 changed files with 36 additions and 17 deletions

9
.gitignore vendored
View File

@ -6,6 +6,7 @@ __pycache__/
*.so
# Distribution / packaging
.eggs/
.Python
env/
bin/
@ -69,3 +70,11 @@ docs/_build/
#OS
.DS_Store
# JetBrains
.idea
# Extra test images installed from pillow-depends/test_images
Tests/images/README.md
Tests/images/msp
Tests/images/picins
Tests/images/sunraster

View File

@ -7,12 +7,12 @@ sudo apt-get -qq install libfreetype6-dev liblcms2-dev python-tk\
python-qt4 ghostscript libffi-dev libjpeg-turbo-progs cmake imagemagick\
libharfbuzz-dev libfribidi-dev
pip install check-manifest
pip install cffi
pip install check-manifest
pip install coverage
pip install olefile
pip install pytest
pip install pytest-cov
pip install -U pytest
pip install -U pytest-cov
pip install pyroma
pip install test-image-results

View File

@ -6,8 +6,8 @@ coverage erase
python setup.py clean
CFLAGS="-coverage" python setup.py build_ext --inplace
coverage run --append --include="PIL/*" selftest.py
python -m pytest -vx --cov PIL --cov-append --cov-report term Tests
python selftest.py
python setup.py test
pushd /tmp/check-manifest && check-manifest --ignore ".coveragerc,.editorconfig,*.yml,*.yaml,tox.ini" && popd
# Docs

View File

@ -15,12 +15,9 @@ co:
done
coverage:
coverage erase
coverage run --parallel-mode --include=PIL/* selftest.py
python -m pytest --cov PIL --cov-append --cov-report html Tests
# Doesn't combine properly before report, writing report instead of displaying invalid report.
python selftest.py
python setup.py test
rm -r htmlcov || true
coverage combine
coverage report
doc:

View File

@ -74,8 +74,13 @@ build_script:
test_script:
- cd c:\pillow
- '%PYTHON%\%PIP_DIR%\pip.exe install nose'
- '%PYTHON%\%EXECUTABLE% test-installed.py -v -s %TEST_OPTIONS%'
- '%PYTHON%\%PIP_DIR%\pip.exe install pytest pytest-cov'
- '%PYTHON%\%EXECUTABLE% -m pytest -vx --cov PIL --cov-append --cov-report term --cov-report xml Tests'
#- '%PYTHON%\%EXECUTABLE% test-installed.py -v -s %TEST_OPTIONS%' TODO TEST_OPTIONS with pytest?
after_test:
- pip install codecov
- codecov --file coverage.xml --name %PYTHON%
matrix:
fast_finish: true

View File

@ -1,2 +1,6 @@
[aliases]
test=pytest
[metadata]
license_file = LICENSE
[tool:pytest]
addopts = -vx --cov PIL --cov-append --cov-report term Tests

View File

@ -751,6 +751,9 @@ def debug_build():
return hasattr(sys, 'gettotalrefcount')
needs_pytest = {'pytest', 'test', 'ptr'}.intersection(sys.argv)
pytest_runner = ['pytest-runner'] if needs_pytest else []
try:
setup(name=NAME,
version=PILLOW_VERSION,
@ -782,7 +785,8 @@ try:
ext_modules=[Extension("PIL._imaging", ["_imaging.c"])],
include_package_data=True,
packages=find_packages(),
test_suite='nose.collector',
setup_requires=pytest_runner,
tests_require=['pytest'],
keywords=["Imaging", ],
license='Standard PIL License',
zip_safe=not (debug_build() or PLATFORM_MINGW), )

View File

@ -7,5 +7,5 @@ pacman -S --noconfirm mingw32/mingw-w64-i686-python3 \
mingw32/mingw-w64-i686-python2-setuptools \
mingw-w64-i686-libjpeg-turbo
/mingw32/bin/pip install nose olefile
/mingw32/bin/pip3 install nose olefile
/mingw32/bin/pip install pytest pytest-cov olefile
/mingw32/bin/pip3 install pytest pytest-cov olefile

View File

@ -16,7 +16,7 @@ def setup_vms():
for arch in ('', X64_EXT):
ret.append("virtualenv -p c:/Python%s%s/python.exe --clear %s%s%s"
% (py, arch, VIRT_BASE, py, arch))
ret.append(r"%s%s%s\Scripts\pip.exe install nose" %
ret.append(r"%s%s%s\Scripts\pip.exe install pytest pytest-cov" %
(VIRT_BASE, py, arch))
return "\n".join(ret)