nose-devs/nose — Issue #11: Config.testMatch is a bogus regex
Author: jpellerin
Created: 2011-12-14 15:54:40+00:00
State: open

What version of the product are you using? On what operating system?
the default source branch as of 2010-04-30

config.py line 145 is:

self.testMatch = re.compile(r'(?:^|[\\b_\\.%s-])[Tt]est' % os.sep)

A minor point first: dot in a character class is always literal, for the obvious reason; no need to escape it.

The main point: \b in a character class is a backspace, not a word boundary. That's why you've got all the
apparently-but-not-actually redundant stuff in there that \b ought to be matching: the ^ anchor, dot,
hyphen, os.sep. The only thing that \b wouldn't cover is underscore.

The pattern *works* adequately, but not as expected, since \b isn't really doing its job. I believe that the
intended regex is more like:

(?:\b|_)[Tt]est

A side note. The intention appears to be to find instances of 'test' set off as a separate 'word', so that you
don't see patterns like 'latest'. However, the pattern matches 'testify' and probably shouldn't. It does not
match myUnitTest, and probably should. It's perhaps not a great idea to fix this, for backwards-
compatibilty reasons. OTOH, it *is* 0.11, so....

Google Code Info:
Issue #: 335
Author: jlundell
Created On: 2010-04-30T21:12:31.000Z
Closed On: