diff --git a/README.txt b/README.txt index 2b6273fd..e8650e05 100644 --- a/README.txt +++ b/README.txt @@ -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 @@ -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 diff --git a/nose/config.py b/nose/config.py index 125eb557..5997aaf7 100644 --- a/nose/config.py +++ b/nose/config.py @@ -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') @@ -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' diff --git a/nose/sphinx/pluginopts.py b/nose/sphinx/pluginopts.py index d2b284ab..2f6e8955 100644 --- a/nose/sphinx/pluginopts.py +++ b/nose/sphinx/pluginopts.py @@ -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)) diff --git a/nose/usage.txt b/nose/usage.txt index bc96894a..5e1d9145 100644 --- a/nose/usage.txt +++ b/nose/usage.txt @@ -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 diff --git a/nosetests.1 b/nosetests.1 index 57728456..cddb6e3e 100644 --- a/nosetests.1 +++ b/nosetests.1 @@ -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 . @@ -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 @@ -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