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: unittest can't deal with packages
Type: behavior Stage:
Components: Library (Lib) Versions: Python 2.5
process
Status: closed Resolution: works for me
Dependencies: Superseder:
Assigned To: Nosy List: Indy, exarkun, georg.brandl
Priority: normal Keywords:

Created on 2009-03-21 18:16 by Indy, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
test Indy, 2009-03-21 18:27
Messages (4)
msg83945 - (view) Author: Aristotelis Mikropoulos (Indy) Date: 2009-03-21 18:16
There is a problem with unittest, as it cannot handle package imports.
This http://dpaste.com/17315/ proves it.
msg83946 - (view) Author: Jean-Paul Calderone (exarkun) * (Python committer) Date: 2009-03-21 18:22
dpaste.com will eventually discard your proof.  You should include all
information for a bug report on the tracker.  You can include the code
in a comment or attach it to the ticket as a file.
msg83947 - (view) Author: Aristotelis Mikropoulos (Indy) Date: 2009-03-21 18:27
You are right, here is the file.
msg85490 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2009-04-05 13:31
Your script is flawed in two parts:

* it doesn't filter the return value of listdir(), which leads to each
test being executed twice in the presence of .pyc files

* __import__("foo.bar") does *not* return the foo.bar submodule, but the
foo module.

But that is all not relevant because your run_tests is not even called
if unittest finds command line arguments that give test names. See
unittest.TestProgram.parseArgs.
History
Date User Action Args
2022-04-11 14:56:46adminsetgithub: 49783
2009-04-05 13:31:25georg.brandlsetstatus: open -> closed

nosy: + georg.brandl
messages: + msg85490

resolution: works for me
2009-03-21 18:27:11Indysetfiles: + test

messages: + msg83947
2009-03-21 18:22:08exarkunsetnosy: + exarkun
messages: + msg83946
2009-03-21 18:16:37Indycreate