msg108008 - (view) |
Author: harobed (harobed) |
Date: 2010-06-17 12:42 |
Hi, in some doctest, I need to stop doctest from a position because the following test is a draft, not implemented. I dream something like this : >>> test_a() True >>> test_b() False #doctest: +DISABLE >>> test_c() True >>> test_d() False #doctest: +ENABLE >>> test_e() True >>> test_f() False Here, test_c and test_d aren't executed. What do you think about this idea ? If it is a good idea, I can implement it. Thanks for your comments, Stephane |
|
|
msg118037 - (view) |
Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) *  |
Date: 2010-10-05 22:28 |
There is already doctest.SKIP. Isn't it already what you want? |
|
|
msg118056 - (view) |
Author: harobed (harobed) |
Date: 2010-10-06 08:07 |
doctest.SKIP is like #doctest: +DISABLE but he don't have #doctest: +ENABLE feature. doctest.SKIP disable all the bottom of test, DISABLE/ENABLE can SKIP only one part of test. Regards, Stephane |
|
|
msg118058 - (view) |
Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) *  |
Date: 2010-10-06 08:58 |
I'm not a great doctest user, but did you try to disable the SKIP directive at the end? something like "doctest: -SKIP" |
|
|
msg118059 - (view) |
Author: Georg Brandl (georg.brandl) *  |
Date: 2010-10-06 08:59 |
AFAIR +SKIP always only refers to one Example anyway. |
|
|
msg118061 - (view) |
Author: harobed (harobed) |
Date: 2010-10-06 11:21 |
Ok, option +SKIP and -SKIP work well, look test.py file I need maybe improve the documentation with an +SKIP and -SKIP example ? Documentation section about SKIP option is here : http://docs.python.org/library/doctest.html?highlight=doctest.skip#doctest.SKIP Regards, Stephane |
|
|
msg118063 - (view) |
Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) *  |
Date: 2010-10-06 11:44 |
harobed, the -SKIP solution does not work. Doctest directives only apply to a single line. After a quick search, I found two workarounds there: http://stackoverflow.com/questions/1809037/python-doctest-skip-entire-block - Replace >>> with >> or - split the docstring, and add something like "__dont_test__ = " in front of the second part; the string becomes part of a statement and won't be parsed. |
|
|
msg173979 - (view) |
Author: Ezio Melotti (ezio.melotti) *  |
Date: 2012-10-27 21:27 |
I'm going to close this as rejected, because the feature doesn't seem too useful, there are available workarounds, and the addition of the ENABLE/DISABLE flags might add confusions. |
|
|