msg129176 - (view) |
Author: blokeley (blokeley) |
Date: 2011-02-23 11:42 |
`python -m unittest discover` caught me out.
I had a test module called `test-foo.py` and no test was loaded.
When I renamed to `test_foo.py` it worked.
The documentation says "For a project’s tests to be compatible with test discovery they must all be importable".
I didn't realise that test-foo would not be importable. Could the documentation say "For a project’s tests to be compatible with test discovery they must all be importable, so ensure that the module names are valid Python identifiers."
Stackoverflow question is here: http://stackoverflow.com/questions/5088960/python-unittest-discovery-does-not-discover-tests
|
msg129179 - (view) |
Author: Michael Foord (michael.foord) * |
Date: 2011-02-23 12:06 |
Sounds like a good change to the docs. Care to provide a patch?
|
msg129189 - (view) |
Author: blokeley (blokeley) |
Date: 2011-02-23 13:18 |
Will do but I haven't submitted a patch before and it's impossible to tell from python.org/dev whether to use the svn or hg repositories.
If possible, please just let me know the URL of the hg repository against which I should make the patch (I don't currently have an svn client).
I tried using hg convert on http://svn.python.org/projects/python/branches/py3k but my company firewall blocked that from working (too many HTTP requests per minute).
|
msg129190 - (view) |
Author: Ezio Melotti (ezio.melotti) * |
Date: 2011-02-23 13:30 |
http://code.python.org/hg/branches/py3k/
|
msg129197 - (view) |
Author: Michael Foord (michael.foord) * |
Date: 2011-02-23 14:29 |
Thanks blokely, looks good. Needs applying to 2.7 / 3.2 and 3.3 branches.
|
msg129209 - (view) |
Author: blokeley (blokeley) |
Date: 2011-02-23 15:40 |
Added release2.7-maint patch.
|
msg129210 - (view) |
Author: blokeley (blokeley) |
Date: 2011-02-23 15:46 |
Added release2.7-maint patch.
|
msg129211 - (view) |
Author: blokeley (blokeley) |
Date: 2011-02-23 15:49 |
Added release3.2-maint patch.
I created the patches by cloning the corresponding hg repo from http://code.python.org/hg If this is the wrong thing to do, let me know.
I have no idea where the 3.3 branch is. Please advise.
|
msg129212 - (view) |
Author: Michael Foord (michael.foord) * |
Date: 2011-02-23 15:50 |
Hey, blokeley the same patch will apply cleanly against 3.2 / 3.3 so no worries.
|
msg129441 - (view) |
Author: Éric Araujo (eric.araujo) * |
Date: 2011-02-25 22:00 |
I’m not sure what’s best between the proposed addition and a link to the definition of module/importable. I think that programmers should know that not all file names are valid module names, so I wouldn’t want us to copy the definition all over the docs. Thoughts?
|
msg129444 - (view) |
Author: Ezio Melotti (ezio.melotti) * |
Date: 2011-02-25 22:15 |
What about something like
"""
In order to be compatible with test discovery, all the test modules must be importable from the top level directory of the project (in other words, they must be part of the project :ref:`package <tut-packages>`, and their name must be valid :ref:`identifiers <identifiers>`).
"""
?
|
msg129489 - (view) |
Author: Éric Araujo (eric.araujo) * |
Date: 2011-02-26 01:30 |
I like that. Is it true that test discovery requires tests to be in a Python package, as opposed to top-level modules?
|
msg129540 - (view) |
Author: Michael Foord (michael.foord) * |
Date: 2011-02-26 13:03 |
No, tests as top level modules work fine too. Importability is the only requirement. (Projects themselves are not typically packages but contain packages - so the wording needs to change slightly but I like the rest.)
|
msg130184 - (view) |
Author: blokeley (blokeley) |
Date: 2011-03-06 18:51 |
Is this wording correct?
"""
In order to be compatible with test discovery, all of the test modules must be importable from the top level directory of the project (in other words, they must be part of the project :ref:`package <tut-packages>` or directly importable :ref:`modules <tut-modules>`, and their names must be valid :ref:`identifiers <identifiers>`).
"""
If this wording is acceptable, I can provide patches.
|
msg130271 - (view) |
Author: Michael Foord (michael.foord) * |
Date: 2011-03-07 18:06 |
Sounds good to me.
|
msg130272 - (view) |
Author: Éric Araujo (eric.araujo) * |
Date: 2011-03-07 18:11 |
I find there are some redundancy and perfectible phrasing. Here’s my rewrite:
In order to be compatible with test discovery, all of the test files must be :ref:`modules <tut-modules>` or :ref:`packages <tut-packages>` importable from the top-level directory of the project (this means that their filenames must be valid :ref:`identifiers <identifiers>`).
|
msg130309 - (view) |
Author: blokeley (blokeley) |
Date: 2011-03-08 10:01 |
Patch for py3k (default branch).
|
msg130310 - (view) |
Author: blokeley (blokeley) |
Date: 2011-03-08 10:02 |
Patch for 2.7 branch.
|
msg130311 - (view) |
Author: blokeley (blokeley) |
Date: 2011-03-08 10:03 |
Patch for 3.2 branch.
This is the first time I've submitted patches so I hope the format is OK. If I could have submitted 1 patch to apply to 2.7, 3.2 and py3k at the same time let me know.
Hope this helps.
|
msg130330 - (view) |
Author: Ezio Melotti (ezio.melotti) * |
Date: 2011-03-08 14:18 |
#11298: Improve the unittest discovery explanation.
http://hg.python.org/cpython/rev/bbf8a8a1af17
|
msg130332 - (view) |
Author: Ezio Melotti (ezio.melotti) * |
Date: 2011-03-08 14:51 |
#11298: merge from 3.2.
http://hg.python.org/cpython/rev/fa23f323d747
|
msg130334 - (view) |
Author: Ezio Melotti (ezio.melotti) * |
Date: 2011-03-08 15:10 |
#11298: Improve the unittest discovery explanation.
http://hg.python.org/cpython/rev/88b5a93b1725
|
msg130336 - (view) |
Author: Ezio Melotti (ezio.melotti) * |
Date: 2011-03-08 15:13 |
Fixed on 2.7, 3.2 and py3k, thanks for the patch!
|
msg131063 - (view) |
Author: R. David Murray (r.david.murray) * |
Date: 2011-03-15 23:15 |
Drat, I accidentally deleted the patch file. Reattaching.
|
|
Date |
User |
Action |
Args |
2022-04-11 14:57:13 | admin | set | github: 55507 |
2011-03-15 23:15:38 | r.david.murray | set | files:
+ issue11298_py2.7.patch nosy:
+ r.david.murray messages:
+ msg131063
|
2011-03-15 23:09:29 | r.david.murray | set | files:
- issue11298_py2.7.patch nosy:
ezio.melotti, eric.araujo, michael.foord, docs@python, blokeley |
2011-03-08 15:13:13 | ezio.melotti | set | status: open -> closed nosy:
ezio.melotti, eric.araujo, michael.foord, docs@python, blokeley messages:
+ msg130336
resolution: fixed stage: patch review -> resolved |
2011-03-08 15:10:15 | ezio.melotti | set | nosy:
ezio.melotti, eric.araujo, michael.foord, docs@python, blokeley messages:
+ msg130334 |
2011-03-08 14:51:04 | ezio.melotti | set | nosy:
ezio.melotti, eric.araujo, michael.foord, docs@python, blokeley messages:
+ msg130332 |
2011-03-08 14:18:32 | ezio.melotti | set | nosy:
ezio.melotti, eric.araujo, michael.foord, docs@python, blokeley messages:
+ msg130330 |
2011-03-08 11:28:32 | ezio.melotti | set | assignee: docs@python -> ezio.melotti nosy:
ezio.melotti, eric.araujo, michael.foord, docs@python, blokeley stage: patch review |
2011-03-08 10:03:52 | blokeley | set | files:
+ issue11298_py3.2.patch nosy:
ezio.melotti, eric.araujo, michael.foord, docs@python, blokeley messages:
+ msg130311
|
2011-03-08 10:02:13 | blokeley | set | files:
+ issue11298_py2.7.patch nosy:
ezio.melotti, eric.araujo, michael.foord, docs@python, blokeley messages:
+ msg130310
|
2011-03-08 10:01:33 | blokeley | set | files:
+ issue11298_default.patch nosy:
ezio.melotti, eric.araujo, michael.foord, docs@python, blokeley messages:
+ msg130309
|
2011-03-08 10:00:13 | blokeley | set | files:
- py3.2-maint_rev9895_issue11298.patch nosy:
ezio.melotti, eric.araujo, michael.foord, docs@python, blokeley |
2011-03-08 10:00:08 | blokeley | set | files:
- py2.7-maint_rev45852_issue11298.patch nosy:
ezio.melotti, eric.araujo, michael.foord, docs@python, blokeley |
2011-03-08 10:00:01 | blokeley | set | files:
- py3k_rev9921_issue11298.patch nosy:
ezio.melotti, eric.araujo, michael.foord, docs@python, blokeley |
2011-03-07 18:11:39 | eric.araujo | set | nosy:
ezio.melotti, eric.araujo, michael.foord, docs@python, blokeley messages:
+ msg130272 |
2011-03-07 18:06:23 | michael.foord | set | nosy:
ezio.melotti, eric.araujo, michael.foord, docs@python, blokeley messages:
+ msg130271 |
2011-03-06 18:51:07 | blokeley | set | nosy:
ezio.melotti, eric.araujo, michael.foord, docs@python, blokeley messages:
+ msg130184 |
2011-02-26 13:04:00 | michael.foord | set | nosy:
ezio.melotti, eric.araujo, michael.foord, docs@python, blokeley messages:
+ msg129540 |
2011-02-26 01:30:35 | eric.araujo | set | nosy:
ezio.melotti, eric.araujo, michael.foord, docs@python, blokeley messages:
+ msg129489 |
2011-02-25 22:15:28 | ezio.melotti | set | nosy:
ezio.melotti, eric.araujo, michael.foord, docs@python, blokeley messages:
+ msg129444 |
2011-02-25 22:00:00 | eric.araujo | set | nosy:
+ eric.araujo messages:
+ msg129441
|
2011-02-23 15:50:32 | michael.foord | set | nosy:
ezio.melotti, michael.foord, docs@python, blokeley messages:
+ msg129212 |
2011-02-23 15:49:23 | blokeley | set | files:
+ py3.2-maint_rev9895_issue11298.patch nosy:
ezio.melotti, michael.foord, docs@python, blokeley messages:
+ msg129211
|
2011-02-23 15:46:13 | blokeley | set | files:
+ py2.7-maint_rev45852_issue11298.patch nosy:
ezio.melotti, michael.foord, docs@python, blokeley messages:
+ msg129210
|
2011-02-23 15:41:19 | blokeley | set | files:
- py2.7-maint_rev45852_issue11298.patch nosy:
ezio.melotti, michael.foord, docs@python, blokeley |
2011-02-23 15:40:34 | blokeley | set | files:
+ py2.7-maint_rev45852_issue11298.patch nosy:
ezio.melotti, michael.foord, docs@python, blokeley messages:
+ msg129209
|
2011-02-23 14:29:09 | michael.foord | set | nosy:
ezio.melotti, michael.foord, docs@python, blokeley messages:
+ msg129197 |
2011-02-23 14:28:00 | blokeley | set | files:
+ py3k_rev9921_issue11298.patch nosy:
ezio.melotti, michael.foord, docs@python, blokeley |
2011-02-23 14:24:26 | blokeley | set | files:
- py3k_rev9921_issue11298.patch nosy:
ezio.melotti, michael.foord, docs@python, blokeley |
2011-02-23 14:23:14 | blokeley | set | files:
+ py3k_rev9921_issue11298.patch nosy:
ezio.melotti, michael.foord, docs@python, blokeley keywords:
+ patch |
2011-02-23 13:30:40 | ezio.melotti | set | nosy:
ezio.melotti, michael.foord, docs@python, blokeley messages:
+ msg129190 |
2011-02-23 13:18:01 | blokeley | set | nosy:
ezio.melotti, michael.foord, docs@python, blokeley messages:
+ msg129189 |
2011-02-23 12:08:31 | ezio.melotti | set | nosy:
+ ezio.melotti
|
2011-02-23 12:06:14 | michael.foord | set | nosy:
+ michael.foord messages:
+ msg129179
|
2011-02-23 11:42:53 | blokeley | create | |