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: Add decorator for tests not yet implemented
Type: enhancement Stage: resolved
Components: Tests Versions: Python 3.3, Python 3.4
process
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: zach.ware Nosy List: ezio.melotti, michael.foord, pitrou, serhiy.storchaka, zach.ware
Priority: normal Keywords: patch

Created on 2013-11-14 22:33 by zach.ware, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
support.not_implemented.diff zach.ware, 2013-11-14 22:33 review
support.not_implemented.v2.diff zach.ware, 2013-11-15 05:23 Add regrtest option review
Messages (5)
msg202907 - (view) Author: Zachary Ware (zach.ware) * (Python committer) Date: 2013-11-14 22:33
Some tests in the test suite are not implemented for one reason or another, and most of these are defined simply as "def test_thats_not_implemented(self): pass", possibly with a comment meant to be a reminder to implement it.  This patch adds a decorator to test.support which turns the non-test into an expected failure with a docstring.  This means that when run in verbose mode, instead of showing:

"""
test_thats_not_implemented (test.test_sometest.TestClass) ... ok
"""

it will instead show:

"""
Not Implemented: TestClass.test_thats_not_implemented ... expected failure
"""

This should make it more obvious that such a test needs some work.  The patch also applies the decorator in test_minidom as an example; there are a few other places that could use it as well.
msg202919 - (view) Author: Zachary Ware (zach.ware) * (Python committer) Date: 2013-11-15 05:23
This patch takes the idea a little further, adding a command line option to regrtest, '--failnoimpl' (it could use a better name).

With this option specified any test decorated by support.not_implemented will not be marked as an expected failure, allowing the NotImplementedError exception to fail the test.  The default under regrtest is to expect the failure, but the default for running a test file directly is to fail loudly.  The idea is just to make it more obvious when a test is just in need of implementation, and could make it easier for new contributors to find something that needs doing.
msg203089 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2013-11-16 21:53
I don't think a new option for regrtest is necessary.
I'm also not sure expected failure is a good idea -- in some cases it might be better to report a skip or an error.
Do you have other examples where this can be used?  If there aren't many occurrences we might also fix them and avoid adding a new decorator.
msg203093 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2013-11-16 21:58
Indeed, this doesn't sound like a terrific idea to me.
msg203337 - (view) Author: Zachary Ware (zach.ware) * (Python committer) Date: 2013-11-19 04:02
There are a couple in pickletester, one in test_io, a few in test_reprlib, and the ones in the patch from test_minidom; some 10 test methods in total that I've found and remembered.  I suppose with that few, it would be best to just open issues for each test module and have them implemented.  Most of them will be getting explicit skips as part of #19572 anyway.

This would tend to make it easier to get away with checking in new unimplemented tests, which isn't really a good thing.  Closing as rejected.
History
Date User Action Args
2022-04-11 14:57:53adminsetgithub: 63796
2013-11-19 04:02:38zach.waresetstatus: open -> closed
messages: + msg203337

assignee: zach.ware
resolution: rejected
stage: patch review -> resolved
2013-11-16 21:58:19pitrousetmessages: + msg203093
2013-11-16 21:53:24ezio.melottisetmessages: + msg203089
2013-11-15 05:24:01zach.waresetfiles: + support.not_implemented.v2.diff

messages: + msg202919
2013-11-14 22:33:12zach.warecreate