Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fix NOSE_TESTMATCH default regex. #950

Merged
merged 5 commits into from
Nov 18, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ nose collects tests automatically from python source files,
directories and packages found in its working directory (which
defaults to the current working directory). Any python source file,
directory or package that matches the testMatch regular expression (by
default: *(?:^|[b_.-])[Tt]est)* will be collected as a test (or source
for collection of tests). In addition, all other packages found in the
default: *(?:\b|_)[Tt]est* will be collected as a test (or source for
collection of tests). In addition, all other packages found in the
working directory will be examined for python source files or
directories that match testMatch. Package discovery descends all the
way down the tree, so package.tests and package.sub.tests and
Expand Down Expand Up @@ -216,8 +216,8 @@ Options
-m=REGEX, --match=REGEX, --testmatch=REGEX

Files, directories, function names, and class names that match this
regular expression are considered tests. Default:
(?:^|[b_./-])[Tt]est [NOSE_TESTMATCH]
regular expression are considered tests. Default: (?:\b|_)[Tt]est
[NOSE_TESTMATCH]

--tests=NAMES

Expand Down
5 changes: 2 additions & 3 deletions nose/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ class Config(object):

self.env = env = kw.pop('env', {})
self.args = ()
self.testMatch = re.compile(r'(?:^|[\\b_\\.%s-])[Tt]est' % os.sep)
self.testMatch = re.compile(env.get('NOSE_TESTMATCH', r'(?:\b|_)[Tt]est'))
self.addPaths = not env.get('NOSE_NOPATH', False)
self.configSection = 'nosetests'
self.debug = env.get('NOSE_DEBUG')
Expand Down Expand Up @@ -180,8 +180,7 @@ class Config(object):
def __init__(self, **kw):
self.env = env = kw.pop('env', {})
self.args = ()
self.testMatchPat = env.get('NOSE_TESTMATCH',
r'(?:^|[\b_\.%s-])[Tt]est' % os.sep)
self.testMatchPat = env.get('NOSE_TESTMATCH', r'(?:\b|_)[Tt]est')
self.testMatch = re.compile(self.testMatchPat)
self.addPaths = not env.get('NOSE_NOPATH', False)
self.configSection = 'nosetests'
Expand Down
3 changes: 3 additions & 0 deletions nose/sphinx/pluginopts.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,9 @@ def format_help(self):
return self.doc.replace('%prog', self.prog).replace(':\n', '::\n')

def add_option(self, *arg, **kw):
for k, v in kw.items():
if isinstance(v, str):
kw[k] = v.replace('\\', '\\\\')
self.opts.append(Opt(*arg, **kw))


Expand Down
2 changes: 1 addition & 1 deletion nose/usage.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ nose collects tests automatically from python source files,
directories and packages found in its working directory (which
defaults to the current working directory). Any python source file,
directory or package that matches the testMatch regular expression
(by default: `(?:^|[\b_\.-])[Tt]est)` will be collected as a test (or
(by default: `(?:\\b|_)[Tt]est` will be collected as a test (or
source for collection of tests). In addition, all other packages
found in the working directory will be examined for python source files
or directories that match testMatch. Package discovery descends all
Expand Down
6 changes: 3 additions & 3 deletions nosetests.1
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.\" Man page generated from reStructuredText.
.
.TH "NOSETESTS" "1" "April 04, 2015" "1.3" "nose"
.TH "NOSETESTS" "1" "November 11, 2015" "1.3" "nose"
.SH NAME
nosetests \- Nicer testing for Python
.
Expand Down Expand Up @@ -43,7 +43,7 @@ nose collects tests automatically from python source files,
directories and packages found in its working directory (which
defaults to the current working directory). Any python source file,
directory or package that matches the testMatch regular expression
(by default: \fI(?:^|[b_.\-])[Tt]est)\fP will be collected as a test (or
(by default: \fI(?:\eb|_)[Tt]est\fP will be collected as a test (or
source for collection of tests). In addition, all other packages
found in the working directory will be examined for python source files
or directories that match testMatch. Package discovery descends all
Expand Down Expand Up @@ -236,7 +236,7 @@ Look for tests in this directory under Python 3.x. Functions the same as \(aqwhe
.INDENT 0.0
.TP
.B \-m=REGEX, \-\-match=REGEX, \-\-testmatch=REGEX
Files, directories, function names, and class names that match this regular expression are considered tests. Default: (?:^|[b_./\-])[Tt]est [NOSE_TESTMATCH]
Files, directories, function names, and class names that match this regular expression are considered tests. Default: (?:\eb|_)[Tt]est [NOSE_TESTMATCH]
.UNINDENT
.INDENT 0.0
.TP
Expand Down