msg177675 - (view) |
Author: Robert Collins (rbcollins) *  |
Date: 2012-12-18 02:28 |
Openstack recently switched from nose to using discover. discover walks the filesystem using os.listdir(), and that is just a thin layer over readdir. On ext3/ext4 filesystems, readdir is in an arbitrary order dependent on file insertion into the directory if dir_index is enabled (which is the default). This means that files are loaded in an order that isn't reproducable by other developers, so bad tests that have isolation issues can be very tricky to track down. Just wrapping the os.listdir() in sorted() would be sufficient to make this robust and repeatable, and avoid the headache. |
|
|
msg177676 - (view) |
Author: Antoine Pitrou (pitrou) *  |
Date: 2012-12-18 06:52 |
+1. It also makes test output nicer. |
|
|
msg177683 - (view) |
Author: Michael Foord (michael.foord) *  |
Date: 2012-12-18 10:26 |
Seems reasonable. |
|
|
msg178141 - (view) |
Author: Ezio Melotti (ezio.melotti) *  |
Date: 2012-12-25 15:40 |
Should this be considered a new feature or should it be applied to older versions as well? |
|
|
msg178159 - (view) |
Author: Michael Foord (michael.foord) *  |
Date: 2012-12-25 18:19 |
It smells like a feature to me (it isn't a direct "bug" fix anyway). It can be applied to earlier versions of Python through a new unittest2 release. |
|
|
msg182792 - (view) |
Author: Martin Melin (mmelin) * |
Date: 2013-02-23 18:58 |
Not sure if there was anything more to it than this, but please find an attempt to add this attached. |
|
|
msg182795 - (view) |
Author: Petri Lehtinen (petri.lehtinen) *  |
Date: 2013-02-23 19:08 |
The patch looks good to me. |
|
|
msg182796 - (view) |
Author: Michael Foord (michael.foord) *  |
Date: 2013-02-23 19:14 |
As we're specifying this behaviour in the documentation it would be nice to test it. |
|
|
msg184539 - (view) |
Author: Jeff Ramnani (jramnani) * |
Date: 2013-03-18 22:28 |
I've added tests for this behavior by un-sorting the test inputs for test_find_tests, and adding comments that the results should be sorted for reliable test execution. Attaching an updated patch. |
|
|
msg184541 - (view) |
Author: Jeff Ramnani (jramnani) * |
Date: 2013-03-18 22:30 |
Fixed a spelling error. |
|
|
msg184542 - (view) |
Author: Jeff Ramnani (jramnani) * |
Date: 2013-03-18 22:30 |
Fixed a spelling error. (Part deux) |
|
|
msg184571 - (view) |
Author: Roundup Robot (python-dev)  |
Date: 2013-03-19 00:50 |
New changeset fe18f16dc2a6 by Michael Foord in branch 'default': Closes issue 16709. unittest test discovery sorts test files for consistent test ordering http://hg.python.org/cpython/rev/fe18f16dc2a6 |
|
|