[New-bugs-announce] [issue16709] unittest discover order is filesystem specific - hard to reproduce

Robert Collins report at bugs.python.org
Tue Dec 18 03:28:57 CET 2012


New submission from Robert Collins:

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.

----------
components: Library (Lib)
messages: 177675
nosy: ezio.melotti, michael.foord, pitrou, rbcollins
priority: normal
severity: normal
status: open
title: unittest discover order is filesystem specific - hard to reproduce
versions: Python 2.7, Python 3.1, Python 3.2, Python 3.3, Python 3.4, Python 3.5

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue16709>
_______________________________________


More information about the New-bugs-announce mailing list