homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Get rid of doctests in packaging.tests.test_version
Type: Stage: resolved
Components: Distutils2 Versions: Python 3.3, 3rd party
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: eric.araujo Nosy List: alexis, eric.araujo, francismb, tarek, tshepang
Priority: normal Keywords: patch

Created on 2012年02月06日 18:58 by tshepang, last changed 2022年04月11日 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
issue13953_58bd6a58365d.patch francismb, 2012年02月08日 19:10 Patch preview review
issue13953_bf6f306ad5cf.patch francismb, 2012年02月09日 21:07 Patch preview review
cleanup-test_version.diff eric.araujo, 2012年02月11日 04:56 review
Messages (9)
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) * (Python committer) 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) * (Python committer) 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) * (Python committer) 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) * (Python committer) 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.
History
Date User Action Args
2022年04月11日 14:57:26adminsetgithub: 58161
2014年03月13日 02:43:18eric.araujosetstatus: open -> closed
resolution: out of date
stage: resolved
2012年02月18日 01:14:43eric.araujounlinkissue13948 superseder
2012年02月14日 15:37:37eric.araujosetmessages: + msg153339
2012年02月12日 10:08:04francismbsetmessages: + msg153193
2012年02月12日 04:01:18eric.araujolinkissue13948 superseder
2012年02月12日 03:46:23eric.araujolinkissue13949 superseder
2012年02月12日 03:44:44eric.araujolinkissue13950 superseder
2012年02月12日 03:08:44eric.araujosetmessages: + msg153150
2012年02月11日 09:20:16francismbsetmessages: + msg153113
2012年02月11日 04:56:31eric.araujosetfiles: + cleanup-test_version.diff

messages: + msg153092
2012年02月09日 21:07:43francismbsetfiles: + issue13953_bf6f306ad5cf.patch

messages: + msg152987
2012年02月08日 19:10:46francismbsetfiles: + issue13953_58bd6a58365d.patch
keywords: + patch
messages: + msg152899
2012年02月08日 16:46:58eric.araujosetassignee: tarek -> eric.araujo
title: test_packaging: unused test? -> Get rid of doctests in packaging.tests.test_version
messages: + msg152888
versions: + 3rd party
2012年02月06日 23:29:50francismbsetnosy: + francismb
2012年02月06日 18:58:59tshepangcreate

AltStyle によって変換されたページ (->オリジナル) /