Skip to content

Commit

Permalink
Merge 0e16233 into 6eb534b
Browse files Browse the repository at this point in the history
  • Loading branch information
hugovk committed Dec 4, 2017
2 parents 6eb534b + 0e16233 commit 502ad0e
Show file tree
Hide file tree
Showing 14 changed files with 50 additions and 92 deletions.
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ __pycache__/
*.so

# Distribution / packaging
.eggs/
.Python
env/
bin/
Expand Down Expand Up @@ -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
5 changes: 3 additions & 2 deletions .travis/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@ sudo apt-get -qq install libfreetype6-dev liblcms2-dev python-tk\
libharfbuzz-dev libfribidi-dev

pip install cffi
pip install nose
pip install check-manifest
pip install coverage
pip install olefile
pip install -U pytest
pip install -U pytest-cov
pip install pyroma
pip install coverage

# docs only on Python 2.7
if [ "$TRAVIS_PYTHON_VERSION" == "2.7" ]; then pip install -r requirements.txt ; fi
Expand Down
4 changes: 2 additions & 2 deletions .travis/script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
coverage run --append --include=PIL/* -m nose -vx Tests/test_*.py
python selftest.py
python setup.py test
pushd /tmp/check-manifest && check-manifest --ignore ".coveragerc,.editorconfig,*.yml,*.yaml,tox.ini" && popd

# Docs
Expand Down
11 changes: 4 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,9 @@ co:
done

coverage:
coverage erase
coverage run --parallel-mode --include=PIL/* selftest.py
nosetests --with-cov --cov='PIL/' --cov-report=html Tests/test_*.py
# 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:
Expand Down Expand Up @@ -81,7 +78,7 @@ release-test:
$(MAKE) install-req
python setup.py develop
python selftest.py
nosetests Tests/test_*.py
python -m pytest Tests
python setup.py install
python test-installed.py
check-manifest
Expand All @@ -92,7 +89,7 @@ sdist:
python setup.py sdist --format=gztar

test:
python test-installed.py
pytest -qq

# https://docs.python.org/2/distutils/packageindex.html#the-pypirc-file
upload-test:
Expand Down
10 changes: 3 additions & 7 deletions Tests/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Dependencies

Install::

pip install coverage nose
pip install pytest pytest-cov

Execution
---------
Expand All @@ -21,12 +21,11 @@ To run an individual test::

Run all the tests from the root of the Pillow source distribution::

nosetests -vx Tests/test_*.py
pytest -vx Tests

Or with coverage::

coverage run --append --include=PIL/* -m nose -vx Tests/test_*.py
coverage report
pytest -vx --cov PIL --cov-report term Tests
coverage html
open htmlcov/index.html

Expand All @@ -39,6 +38,3 @@ To run an individual test::
Run all the tests from the root of the Pillow source distribution::

./test-installed.py



11 changes: 6 additions & 5 deletions Tests/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@ def delete_tempfile(self, path):
try:
ok = self.currentResult.wasSuccessful()
except AttributeError: # for nosetests
proxy = self.currentResult
ok = (len(proxy.errors) + len(proxy.failures) == 0)
# proxy = self.currentResult
# ok = (len(proxy.errors) + len(proxy.failures) == 0)
ok = True # TODO pytest

if ok:
# only clean out tempfiles if test passed
Expand Down Expand Up @@ -180,15 +181,15 @@ class PillowLeakTestCase(PillowTestCase):
# requires unix/osx
iterations = 100 # count
mem_limit = 512 # k

def _get_mem_usage(self):
"""
Gets the RUSAGE memory usage, returns in K. Encapsulates the difference
between OSX and Linux rss reporting
:returns; memory usage in kilobytes
"""

from resource import getpagesize, getrusage, RUSAGE_SELF
mem = getrusage(RUSAGE_SELF).ru_maxrss
if sys.platform == 'darwin':
Expand All @@ -199,7 +200,7 @@ def _get_mem_usage(self):
# linux
# man 2 getrusage
# ru_maxrss (since Linux 2.6.32)
# This is the maximum resident set size used (in kilobytes).
# This is the maximum resident set size used (in kilobytes).
return mem # Kb

def _test_leak(self, core):
Expand Down
9 changes: 7 additions & 2 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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-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
Expand Down
25 changes: 0 additions & 25 deletions profile-installed.py

This file was deleted.

4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ docutils
jarn.viewdoc
Jinja2
MarkupSafe
nose
nose-cov
olefile
pycodestyle
pytest
pytest-cov
pyflakes
Pygments
pyroma
Expand Down
4 changes: 4 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
[aliases]
test=pytest
[metadata]
license_file = LICENSE
[tool:pytest]
addopts = -vx --cov PIL --cov-report term Tests
7 changes: 6 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ class RequiredDependencyException(Exception): pass
PLATFORM_MINGW = 'mingw' in ccompiler.get_default_compiler()
PLATFORM_PYPY = hasattr(sys, 'pypy_version_info')


def _dbg(s, tp=None):
if DEBUG:
if tp:
Expand Down Expand Up @@ -748,6 +749,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,
Expand Down Expand Up @@ -779,7 +783,8 @@ def debug_build():
include_package_data=True,
packages=find_packages(),
scripts=glob.glob("Scripts/*.py"),
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), )
Expand Down
35 changes: 0 additions & 35 deletions test-installed.py

This file was deleted.

4 changes: 2 additions & 2 deletions winbuild/appveyor_install_msys2_deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions winbuild/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -76,7 +76,7 @@ def build_one(py_ver, compiler):
args['executable'] = "python.exe"
if 'EXECUTABLE' in os.environ:
args['executable'] = "%EXECUTABLE%"

args['py_ver'] = py_ver
if '34' in py_ver:
args['tcl_ver'] = '86'
Expand Down

0 comments on commit 502ad0e

Please sign in to comment.