-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Test with pytest #2815
Test with pytest #2815
Conversation
d95f739
to
6c1428b
Compare
Updated AppVeyor/Windows builds with pytest, now with codecov coverage! Coverage goes up from 82.87% to 83.19%. https://codecov.io/gh/hugovk/pillow/tree/ccbb85794c1399efea5b87a49b82309d4f1cb0e0/PIL |
test-installed.py@wiredfool Do you still use test-installed.py? Please can you check if this pytest version works for you? (I've commented out the profile-installed.pyAnd do you still use profile-installed.py? I've not updated it, but running it on master with no changes gives a ⌂93% [hugo:~/github/Pillow] master(5)+* ± python profile-installed.py
4 function calls in 0.001 seconds
Ordered by: cumulative time
ncalls tottime percall cumtime percall filename:lineno(function)
1 0.000 0.000 0.001 0.001 profile:0(nose.main())
1 0.001 0.001 0.001 0.001 :0(setprofile)
1 0.000 0.000 0.000 0.000 :0(exec)
1 0.000 0.000 0.000 0.000 <string>:1(<module>)
0 0.000 0.000 profile:0(profiler)
Traceback (most recent call last):
File "profile-installed.py", line 25, in <module>
profile.run("nose.main()", sort=2)
File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/profile.py", line 93, in run
return _Utils(Profile).run(statement, filename, sort)
File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/profile.py", line 55, in run
prof.run(statement)
File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/profile.py", line 418, in run
return self.runctx(cmd, dict, dict)
File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/profile.py", line 424, in runctx
exec(cmd, globals, locals)
File "<string>", line 1, in <module>
NameError: name 'nose' is not defined |
Can't say that I remember ever using profile-installed. I do use test-installed.py all the time, as I really don't like the in-place build thing. (fwiw, my usual loop is |
I've been attempting to fix the coverage for the Docker images (which are only sort of catching the C code currently) by following the changes here, but it's not working.
|
test-installed.pyTrying to get test-installed.py working:
The path-monkeying inside test-installed.py:
is working and removing But pytest (when called as print(os.path.dirname(PIL.__file__))
print(sys.path) We get PIL from the wrong place due to the path: /Users/hugo/github/Pillow/PIL
['/Users/hugo/github/Pillow/Tests', '/Users/hugo/github/Pillow', '', ... However, running a simple /usr/local/lib/python2.7/site-packages/Pillow-4.4.0.dev0-py2.7-macosx-10.12-x86_64.egg/PIL
['/Users/hugo/github/Pillow/Tests', '/usr/local/bin', ... I think that is explained by this -- (https://docs.pytest.org/en/latest/pythonpath.html#invoking-pytest-versus-python-m-pytest); calling
How about we remove test-installed.py and update the Makefile so |
Python 3.3 is failing on AppVeyor because pytest no longer supports EOL Python 2.6 or 3.3.
We could pin to an old version of pytest for 3.3, but I'd rather we just drop it to make things easier for us, as I expect pytest won't be the only thing dropping 3.3 in the near future. Here's the pip installs for pillow from PyPI for the last month (via
Thoughts? |
If we drop a python version, we've got to have it in the release notes, and I think we're going to trigger a major version rev as well. |
For parallel testing, there's a problem with a test: pip install pytest-xdist
pytest -n 4
This doesn't happen with plain sequential pytest, or with |
That test is changing shortly anyway. |
We're ~10 days out, do you think this one is going to land? |
Yes. I think we're more or less good in this repo and it's ready for review. The parallel things can come later. Next steps is to update docker-images and pillow-wheels. I'm not sure what's the best way to tackle those, regarding the dependencies between those repos and this. Any ideas? |
Looks like the removal of scripts caused a merge error here. |
Try |
Ah, Also, can we remove the --cov from the default options, as there's no need to run coverage on dev machines. |
So, pytest-xdist definitely has a different path when running with Multiproc: ['/Users/erics/Pillow/Tests', '/Users/erics/Pillow', '', '/Users/erics/vpy35/lib/python3.5/site-packages/olefile-0.43-py3.5.egg', '/Users/erics/vpy35/lib/python3.5/site-packages/Pillow-5.0.0.dev0-py3.5-macosx-10.11-x86_64.egg', '/Users/erics/vpy35/lib/python35.zip', '/Users/erics/vpy35/lib/python3.5', '/Users/erics/vpy35/lib/python3.5/plat-darwin', '/Users/erics/vpy35/lib/python3.5/lib-dynload', '/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5', '/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/plat-darwin', '/Users/erics/vpy35/lib/python3.5/site-packages'] vs: ['/Users/erics/Pillow/Tests', '/Users/erics/vpy35/bin', '/Users/erics/vpy35/lib/python3.5/site-packages/olefile-0.43-py3.5.egg', '/Users/erics/vpy35/lib/python3.5/site-packages/Pillow-5.0.0.dev0-py3.5-macosx-10.11-x86_64.egg', '/Users/erics/vpy35/lib/python35.zip', '/Users/erics/vpy35/lib/python3.5', '/Users/erics/vpy35/lib/python3.5/plat-darwin', '/Users/erics/vpy35/lib/python3.5/lib-dynload', '/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5', '/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/plat-darwin', '/Users/erics/vpy35/lib/python3.5/site-packages'] Note that the multiprocessor one uses the source directory, and the non-multiproc one uses the installed directory (in the second entry). |
.travis/script.sh
Outdated
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this going to do coverage without having it in the defaults?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(previous comment deleted)
Updated to not use python setup.py test
, and therefore not use setup.cfg's defaults.
#2911 fixes the path issue, I think once and for all. |
Merged with #2911 |
Thanks for finishing this up! |
Fixes #2812.
Changes proposed in this pull request:
Comparing a before and after coverage report shows the coverage dropped, and that's a good thing! Nose was missing out 4 source files as they weren't touched at all by tests: GdImageFile.py, ImageDraw2.py, OleFileIO.py, WalImageFile.py. Otherwise the Python and C coverage is identical.
TODO:
shortDescription
which prevented printing docstrings in nosetests