Repository navigation
Use unittest for tests - #699
Conversation
|
Coverage decreased because more code is included in the report. Before: 6584 OF 9036 RELEVANT LINES COVERED These two files weren't included before and they brought the average down a bit: Before: https://coveralls.io/builds/852429 |
|
Yeah, I'm just happy we are tracking coverage 👍 |
|
Re the other tests:
These at least are useful. |
|
Ok, this is still somewhat troublesome OMM, or at least for how I'm working. <parenthetical> For clarity, my setup is: A bunch of virtualenvs: Plus one Pillow directory. From within the pillow directory, I hack, and then: And in another terminal window, I'll have a 3.x virtualenv going with the same set of commands. If necessary, I'll use the dbg versions for gdb, or whatever. </parenthetical> The root problem, I think, is that these tests are working against an in place build, not an installed version. We worked around the import issue in the old test suite with the I don't like in place builds for a few reasons:
I also think that it's extremely valuable to be able to test the current installed Pillow build without building whatever is currently in the source directory. |
|
@wiredfool Can we support both in-place and installed test running? For whatever it's worth, I think I find installed-test-running less attractive. |
|
I'm not arguing for removing in place -- Clearly others find it useful. I'm arguing for whatever we do retaining the ability to test installed code. |
|
👍 |
|
@hugovk Can that be added or do we need to revert again? 😄 |
|
OK, so the old runner calls @wiredfool Would an environment variable be ok rather than a command-line argument? That would be easier to implement for nose, otherwise we'll probably need different handling to run the full set with nose (perhaps via a plugin like this) and individually. I'd like to keep it so the tests can be run individually without nose ( (Likewise there should be no problem running individual tests with nose ( |
|
It looks like the old runner calls An environment variable is ok, not what I'd prefer, but it's going to be easier than monkeypatching. (the difference between FOO=bar nosetests and nosetests--foo-bar is minimal, just different typing) There are a couple of possible command line flags for nosetests, --first-package-wins and --no-path-adjustment that might do something useful. |
|
I could swear that there was some monkeying around with sys.path to make the imports work in the old testing setup, but it's just not there. (Well, it's in |
|
e.g., this test file: yields this: And also this: So, nose, by default adds the absolute path for . and the test location to the python path. I/We need the test location, but not the initial directory. So far, I haven't been able to get it to work on command lines or from various options to |
|
No luck so far. I found one suggestion saying to create a blank I'm on Windows right now but I had problems on Mac with |
|
#706 is (among other things) a test runner helper that does the necessary path twiddling to get nosetests to run on the installed version of Pillow (at least in virtualenvs on ubuntu). It gets me back to the point that I can test proposed patches against HEAD again. |
|
Great! |
Replaces #693 and preserves history.
Notes:
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(see.travis.ymlfor latest command):nosetests Tests/test_*.pycoverage run --append --include=PIL/* -m nose Tests/test_*.pyTODO:
helper.pystill has some commented out stuff fromtester.py.lena()opens images fresh from disk to ensure tests are independent and repeatable. It would be better to caches images for speed (no caching is around 60% slower). What's the best way to create a 100% duplicate copy of an image? There's no point testing on a copy if it loses important information from the original.test_olefileio.pyback upstream.Tests/. Are these still needed?Tests/bench_cffi_access.pyTests/bench_get.pyTests/cms_test.pyTests/crash_ttf_memory_error.pyTests/helper.pyTests/import_all.pyTests/large_memory_numpy_test.pyTests/large_memory_test.pyTests/make_hash.pyTests/show_icc.pyTests/show_mcidas.pyTests/threaded_save.pyTests/versions.py