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: Fix test discovery for test_bisect.py
Type: behavior Stage: resolved
Components: Tests Versions: Python 3.3, Python 3.4
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: ezio.melotti Nosy List: brett.cannon, ezio.melotti, python-dev, zach.ware
Priority: normal Keywords: patch

Created on 2013-01-08 21:39 by zach.ware, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
test_bisect_fix.diff zach.ware, 2013-01-08 21:39 test_bisect.py fix, version 1 review
test_bisect_fix.v2.diff zach.ware, 2013-01-09 15:33 Version 2 review
Messages (7)
msg179374 - (view) Author: Zachary Ware (zach.ware) * (Python committer) Date: 2013-01-08 21:39
Here's the fix for test_bisect.py.

This one has an extra change, that of replacing the manual method of obtaining c_bisect and py_bisect with two calls to support.import_fresh_module.

This one also has an extra wrench thrown in the gears by including a few doctests.  I haven't changed anything in relation to those doctests, but I wonder if there's really any point to keeping them there considering they claim to be pulled from the docs but are in fact significantly different from what is in the docs these days.
msg179413 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2013-01-09 06:17
The best thing would be converting them to unittest (if there aren't already unittests for that).

A general comment about these patches: I think it would be better to remove test_main() (and related unnecessary code) with unittest.main().  One of the advantage of doing it now is that you can simply test discovery by doing ./python Lib/test/test_foo.py.

This is currently being discussed on #16748, but I think we pretty much agree on this.
msg179416 - (view) Author: Zachary Ware (zach.ware) * (Python committer) Date: 2013-01-09 06:47
> A general comment about these patches: I think it would be better to
remove test_main() (and related unnecessary code) with unittest.main().
 One of the advantage of doing it now is that you can simply test discovery
by doing ./python Lib/test/test_foo.py.
>
> This is currently being discussed on #16748, but I think we pretty much
agree on this.
>

Ah yes, I meant to do that and completely forgot about it. I'll go through
and do that on the ones I've made patches for so far in the morning.
msg179417 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2013-01-09 07:03
I think that here all the test_main() can be removed except support.run_doctest(test_bisect, verbose).  This should probably be moved after unittest.main() (unless the doctests are removed/converted to unittest).  Refcounting is already provided by regrtest.
msg179454 - (view) Author: Zachary Ware (zach.ware) * (Python committer) Date: 2013-01-09 15:33
Here's version 2 of the patch, which converts the doctests to a standard testcase and removes test_main().
msg179512 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-01-10 02:33
New changeset f32cb5389a4b by Ezio Melotti in branch '3.3':
#16897: test_bisect now works with unittest test discovery.  Initial patch by Zachary Ware.
http://hg.python.org/cpython/rev/f32cb5389a4b

New changeset cfd8d99ae645 by Ezio Melotti in branch 'default':
#16897: merge with 3.3.
http://hg.python.org/cpython/rev/cfd8d99ae645
msg179513 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2013-01-10 02:34
Fixed, thanks for the patch!
While I was at it I also added the other example from the doc.
History
Date User Action Args
2022-04-11 14:57:40adminsetgithub: 61101
2013-01-10 02:34:40ezio.melottisetstatus: open -> closed
resolution: fixed
messages: + msg179513
2013-01-10 02:33:36python-devsetnosy: + python-dev
messages: + msg179512
2013-01-09 15:33:43zach.waresetfiles: + test_bisect_fix.v2.diff

messages: + msg179454
2013-01-09 07:03:15ezio.melottisetmessages: + msg179417
2013-01-09 06:47:22zach.waresetmessages: + msg179416
2013-01-09 06:17:01ezio.melottisetassignee: ezio.melotti
messages: + msg179413
stage: resolved
2013-01-08 21:39:05zach.warecreate