When testutil wants to update the global configuration with test.cfg, it's trying to guess the module name (code line 37). It seems that the endswith('config') is a weak test for that purpose: It might match something completely irrelevant.
We use mercurial as our vcs. Mercurial happens to have a .hg/store/data/transifex/config/ dir in the .hg directory. if os.walk(pwd) returns that dir before the correct transifex/config dir the whole thing breaks causing tests to be completely unusable.
This is not always reproducible, it depends on the order os.walk returns directories.
# Override config of all applications with test.cfg
if os.path.exists(os.path.join(cwd, "test.cfg")):
modulename = None
for w in os.walk(cwd):
if w[0].endswith("config"):
config_dir = w[0].replace(cwd, "")[1:]
modulename = "%s.app" % config_dir.replace(os.sep, ".")
break
update_config(configfile=os.path.join(cwd, "test.cfg"),
modulename=modulename)