msg152756 - (view) |
Author: Tshepang Lekhonkhobe (tshepang) * |
Date: 2012-02-06 18:58 |
I'm not sure what's happening here (not sure how doctest works), but I suspect that there is no test at all. Perhaps it was forgotten: http://hg.python.org/cpython/file/567767a6df02/Lib/packaging/tests/test_version.py#l68. I say this because it whatever change I make to that long string, I always get a successful test. |
|
|
msg152888 - (view) |
Author: Éric Araujo (eric.araujo) *  |
Date: 2012-02-08 16:46 |
The interesting line is just after the string: doctest.script_from_examples(comparison_doctest_string) However it looks like there has been a problem with that line, as you can’t get the test to fail, which is strange as I did use that doctest to check #11841! Instead of using time to figure out doctest antics, I will just use good old reliable integrated unittest. |
|
|
msg152899 - (view) |
Author: Francis MB (francismb) * |
Date: 2012-02-08 19:10 |
Hi here's a patch preview: it has to be re factored further but I stopped here as some tests failed: the out commented ones ... I've checked twice but I cannot see any diff, could you check that? Or, has maybe the behavior (due that bug) changed and nobody noticed? Thanks in advance ! Francis |
|
|
msg152987 - (view) |
Author: Francis MB (francismb) * |
Date: 2012-02-09 21:07 |
I've done some cleanups |
|
|
msg153092 - (view) |
Author: Éric Araujo (eric.araujo) *  |
Date: 2012-02-11 04:56 |
Thanks, I’ve got it from that point. Notes for future patches: - Tests should not check the exact contents of error messages, as they are not part of the language - Don’t use assertEqual(..., True) but assertTrue, or if you’re testing comparisons, use assertGreater and friends (or check the result of sorted(somelist) to compare a bunch of objects at once) |
|
|
msg153113 - (view) |
Author: Francis MB (francismb) * |
Date: 2012-02-11 09:20 |
Thank you for the review. Just some questions: Isn't that what the previous code (doctest code) did? I thought that the code should be ported as far backwards as possible and that's why I used the plain assertEqual (I don't know exactly in with version the other assert methods were introduced. Unittest2?) Can one use all the new unittest2 methods to test packaging (distutils2) code? > ---------- > Added file: http://bugs.python.org/file24482/cleanup-test_version.diff > > _______________________________________ > Python tracker<report@bugs.python.org> > <http://bugs.python.org/issue13953> > _______________________________________ > |
|
|
msg153150 - (view) |
Author: Éric Araujo (eric.araujo) *  |
Date: 2012-02-12 03:08 |
> Isn't that what the previous code (doctest code) did? I don’t understand, could you rephrase? > I thought that the code should be ported as far backwards as possible and that's why I > used the plain assertEqual (I don't know exactly in with version the other assert > methods were introduced. Unittest2?) Michael Foord took over maintenance of unittest and released a bunch of improvements for 2.7 and 3.1, then further improvements in 3.2. unittest2 is a standalone release of this improved unittest (not sure if it’s like 3.1 or 3.2). For packaging in the 3.3 stdlib we have all new methods, and for distutils2 we use unittest2 which has them too and works with 2.4, so we have compat. |
|
|
msg153193 - (view) |
Author: Francis MB (francismb) * |
Date: 2012-02-12 10:08 |
Does a "doc test" test the output literally? (I've just always used unittest) Ok, thanks |
|
|
msg153339 - (view) |
Author: Éric Araujo (eric.araujo) *  |
Date: 2012-02-14 15:37 |
> Does a "doc test" test the output literally? Yes, that’s the problem. See doctest documentation for more info about how it works and what problems it has. |
|
|