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: queue unittest errors
Type: behavior Stage: resolved
Components: Tests Versions: Python 3.2, Python 3.3, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: anacrolix, benjamin.peterson, georg.brandl, maker, python-dev, r.david.murray, rhettinger
Priority: normal Keywords: patch

Created on 2012-03-16 07:45 by anacrolix, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
issue14333_decorators.patch maker, 2012-03-17 17:51 review
issue14333.patch maker, 2012-03-17 17:51 review
Messages (6)
msg156006 - (view) Author: Matt Joiner (anacrolix) Date: 2012-03-16 07:45
$ python3.3 -m unittest test.test_queue

Generates errors in the unit test code of the form

AttributeError: 'BaseQueueTest' object has no attribute 'type2test'
msg156183 - (view) Author: Michele Orrù (maker) * Date: 2012-03-17 17:51
This bug is becouse of Lib/unittest/loader.py:107 . So a quick fix would be to inherit from unittest.TestCase only in the exposed classes; but probably using a class decorator is the best solution.
msg156187 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2012-03-17 18:06
The decorator solution looks overly mind-boggling for this simple case.

BTW, I'm not sure we support calling our tests in this way, but it would be a good goal to, so I'm in favor of fixing these kinds of problems.
msg156201 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2012-03-17 20:45
New changeset 118f7bdd631b by R David Murray in branch '3.2':
#14333: fix test_queue so it can be run via standard unittest test discovery.
http://hg.python.org/cpython/rev/118f7bdd631b

New changeset 3ea4d7adb3e7 by R David Murray in branch 'default':
Merge #14333: fix test_queue so it can be run via standard unittest test discovery.
http://hg.python.org/cpython/rev/3ea4d7adb3e7

New changeset 340053208864 by R David Murray in branch '2.7':
#14333: fix test_queue so it can be run via standard unittest test discovery.
http://hg.python.org/cpython/rev/340053208864
msg156202 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2012-03-17 20:49
Not only do I think we should support calling our tests via unittest, I think we should move in the direction of having regrtest be implemented via standard unittest hooks rather than the monster it currently is.  That will take quite a bit of effort, though :)

Given that we are in fact using unittest, I think it is much clearer to follow the standard unittest pattern and have tests that are supposed to be run marked by subclassing TestCase, rather than by being explicitly nominated in boilerplate at the bottom.  Certainly any new test files I write work that way (and I even explicitly use test discovery in test_email).
msg156220 - (view) Author: Matt Joiner (anacrolix) Date: 2012-03-18 01:06
Yes, FWIW much of the standard library tests are callable this way without issue. I have patches that fix the discoverability of a few test modules. I'll submit these in another issue.
History
Date User Action Args
2022-04-11 14:57:28adminsetgithub: 58541
2012-03-18 01:06:25anacrolixsetmessages: + msg156220
2012-03-17 20:49:40r.david.murraysetstatus: open -> closed

versions: + Python 2.7, Python 3.2
nosy: + r.david.murray

messages: + msg156202
resolution: fixed
stage: resolved
2012-03-17 20:45:35python-devsetnosy: + python-dev
messages: + msg156201
2012-03-17 18:06:47georg.brandlsetnosy: + georg.brandl
messages: + msg156187
2012-03-17 17:51:42makersetfiles: + issue14333.patch
2012-03-17 17:51:25makersetfiles: + issue14333_decorators.patch
keywords: + patch
messages: + msg156183
2012-03-17 17:25:18makersetnosy: + maker
2012-03-16 07:45:44anacrolixcreate