summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Szakmeister <john@szakmeister.net>2015-11-18 06:29:22 -0500
committerJohn Szakmeister <john@szakmeister.net>2015-11-18 06:29:22 -0500
commit7c8f005616223d4f585204535c7c5c800daaf0fb (patch)
tree3d64e0704503070c055bfead21e962a0466c9870
parent9371c974fb48fe0e002f4776ea342eaf0347e7f4 (diff)
parentdd93fe020c19e7db146df35c454ae8d7bb298039 (diff)
downloadnose-7c8f005616223d4f585204535c7c5c800daaf0fb.tar.gz
Merge pull request #950 from kengruven/master
Fix NOSE_TESTMATCH default regex.
-rw-r--r--README.txt8
-rw-r--r--nose/config.py5
-rw-r--r--nose/sphinx/pluginopts.py3
-rw-r--r--nose/usage.txt2
-rw-r--r--nosetests.16
5 files changed, 13 insertions, 11 deletions
diff --git a/README.txt b/README.txt
index 2b6273f..e8650e0 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 125eb55..5997aaf 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 d2b284a..2f6e895 100644
--- a/nose/sphinx/pluginopts.py
+++ b/nose/sphinx/pluginopts.py
@@ -157,6 +157,9 @@ class OptBucket(object):
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 bc96894..5e1d914 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 5772845..cddb6e3 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