Repository navigation
Start using unittest for tests - #693
Conversation
Conflicts: .travis.yml
|
The reason coverage decreased 0.47% is because for some reason ImageGrab.py wasn't being included in the report with the old test runner. After, when being tested via unititest, it's included in the report. Before coverage was 72.86%. After, when including ImageGrab.py, that file's 25% coverage brought the average down. Before: https://coveralls.io/builds/835904 (The reason for the second decrease (and failure) is an occasional Fatal RPython error with PyPy for test_imagedraw.py, meaning it's coverage didn't all get included. I've seen this problem with test_imagedraw.py on the old test runner too, so it's not directly related to using unittest.) |
Otherwise it sometimes, but not always, causes an error: RPython traceback: File "rpython_jit_metainterp_compile.c", line 20472, in send_loop_to_backend File "rpython_jit_backend_x86_assembler.c", line 1818, in Assembler386_assemble_loop File "rpython_jit_backend_x86_regalloc.c", line 293, in RegAlloc_prepare_loop File "rpython_jit_backend_x86_regalloc.c", line 909, in RegAlloc__prepare File "rpython_jit_backend_llsupport_regalloc.c", line 4706, in compute_vars_longevity Fatal RPython error: AssertionError /home/travis/build.sh: line 236: 7300 Aborted
|
@aclark4life I'll merge it and update this PR tomorrow. |
|
Great, thanks |
More tests and merge with upstream
|
@aclark4life OK ready, more tests added and merged with upstream. I'll add mores tests in another branch and create a new PR later. Still TODO:
But new tests, if |
Start using unittest for tests
|
Thanks! |
|
So... Where's the test runner for these? |
|
Ok, found nose. Appears broken. |
|
Also, now we've lost all the SCM context of the tests -- git blame and git log are essentially showing a bunch of brand new files. |
|
Try |
|
@wiredfool How is it possible to lose context? Any idea what caused the loss of context? Maybe @hugovk can look into it… |
|
Ok, I think that the context loss is basically due to the combination of moving the files and changing all of the lines at the same time due to hoisting them into classes. I'm not good enough at git to know if there's a good solution, but it would be nice if there was a way to connect the history of the files together. |
|
Ah I see, that is annoying |
|
To run the an individual test, use either:
To run the whole batch (e.g. like on Travis CI) use
All these can take a |
|
Re: history I did Git does have some rename support, and there's a Here's an idea: If you want to back up this PR out of master (there's been no unrelated commits afterwards) then when I have all the tests converted, I can make a fresh PR from a fresh branch by just replacing the files and leaving them in the Current status: Branch: https://github.com/hugovk/Pillow/tree/unittest2tempfile I'm almost done converting all the files, just have the last one to fix. It seems this is because the original (Well, there's one more I've not yet done -- |
|
How far back should I go, just: 001b46c or further? |
|
@aclark4life To the one just before that, so 8beb664 will be the latest. I've made a new branch based on 8beb664 and am adding the tests in with fresh commits so they remain in the |
|
OK, new branch is ready with preserved history. I'll create a new PR. |
|
K, working on the revert(s) |
|
@hugovk Let me know how the revert looks and if OK I'll merge your new PR |
|
Looks like PyPy testing failed on Travis but we can probably fix that up |
|
@aclark4life PR here: #699 |
|
@hugovk Thanks, so my revert looks OK? |
|
@aclark4life Yes, all merged smoothly. |
|
Thanks, done! |
I spotted in
PIL/tests.pythe idea to start moving the tests to use theunittestmodule. Here's a start.Notes:
PIL/it's better they have their own directory. A common one istests/but we have the old ones inTests/so I'm putting them intest/to make it clear which are which.tester.pyis nowhelper.pyand contains helper functions likelena()and a base classPillowTestCase(unittest.TestCase).unittest2which has them backported.PillowTestCasedefines the extra asserts likeassert_image_equal().test/test_*.pyfiles have a test class that derives fromPillowTestCaseso they can useassert_image_equal()and so on.test/test_*.pyhaveif __name__ == '__main__': unittest.main()so they can be individually run:python test/test_something.pynosetests:nosetests test/coverage run --append --include=PIL/* -m nose test/helper.pystill has a lot of commented out stuff fromtester.py. I'm uncommenting and updating things as needed, so no commented stuff will be left at the end.TODO:
tempfile()and cleanup.test_something.pyunless the test failed.Any comments?