From a25c9d62e6f05932872010cb39d101179f20181f Mon Sep 17 00:00:00 2001 From: Ken Harris Date: Tue, 15 Sep 2015 14:13:36 -0700 Subject: Fix NOSE_TESTMATCH default regex. See bug #11. --- README.txt | 2 +- nose/config.py | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/README.txt b/README.txt index 2b6273f..a8cc961 100644 --- a/README.txt +++ b/README.txt @@ -217,7 +217,7 @@ Options Files, directories, function names, and class names that match this regular expression are considered tests. Default: - (?:^|[b_./-])[Tt]est [NOSE_TESTMATCH] + (?:\b|_)[Tt]est [NOSE_TESTMATCH] --tests=NAMES diff --git a/nose/config.py b/nose/config.py index 125eb55..72554a5 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(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' -- cgit v1.2.1 From 17ebf681d223ba234a5c78ae1e400c74b130d368 Mon Sep 17 00:00:00 2001 From: Ken Harris Date: Thu, 24 Sep 2015 09:01:15 -0700 Subject: Update Config class docstring for 'testMatch' --- nose/config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nose/config.py b/nose/config.py index 72554a5..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|_)[Tt]est') + 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') -- cgit v1.2.1 From 56d64c0bb8c171471607506c07c875763464e629 Mon Sep 17 00:00:00 2001 From: Ken Harris Date: Wed, 11 Nov 2015 09:34:43 -0800 Subject: Fix default testMatch in usage.txt This fixes the top half of nosetests.1 and README.txt. --- README.txt | 4 ++-- nose/usage.txt | 2 +- nosetests.1 | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.txt b/README.txt index a8cc961..c7d6624 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 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..f1a0c44 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 -- cgit v1.2.1 From ca3e447f65d7aa90c73593ba99f2ea9e95d8ed99 Mon Sep 17 00:00:00 2001 From: Ken Harris Date: Wed, 11 Nov 2015 09:48:04 -0800 Subject: Escape backslashes for Sphinx, in OptBucket This fixes the -m flag documentation for both the README.txt and nosetests.1 manpage. --- README.txt | 4 ++-- nose/sphinx/pluginopts.py | 2 ++ nosetests.1 | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/README.txt b/README.txt index c7d6624..e8650e0 100644 --- a/README.txt +++ b/README.txt @@ -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/sphinx/pluginopts.py b/nose/sphinx/pluginopts.py index d2b284a..4960b92 100644 --- a/nose/sphinx/pluginopts.py +++ b/nose/sphinx/pluginopts.py @@ -157,6 +157,8 @@ class OptBucket(object): return self.doc.replace('%prog', self.prog).replace(':\n', '::\n') def add_option(self, *arg, **kw): + kw = {k: (v.replace('\\', '\\\\') if isinstance(v, str) else v) + for (k, v) in kw.items()} self.opts.append(Opt(*arg, **kw)) diff --git a/nosetests.1 b/nosetests.1 index f1a0c44..cddb6e3 100644 --- a/nosetests.1 +++ b/nosetests.1 @@ -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 -- cgit v1.2.1 From dd93fe020c19e7db146df35c454ae8d7bb298039 Mon Sep 17 00:00:00 2001 From: Ken Harris Date: Wed, 11 Nov 2015 10:47:23 -0800 Subject: Fix OptBucket for Python 2.6 --- nose/sphinx/pluginopts.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/nose/sphinx/pluginopts.py b/nose/sphinx/pluginopts.py index 4960b92..2f6e895 100644 --- a/nose/sphinx/pluginopts.py +++ b/nose/sphinx/pluginopts.py @@ -157,8 +157,9 @@ class OptBucket(object): return self.doc.replace('%prog', self.prog).replace(':\n', '::\n') def add_option(self, *arg, **kw): - kw = {k: (v.replace('\\', '\\\\') if isinstance(v, str) else v) - for (k, v) in kw.items()} + for k, v in kw.items(): + if isinstance(v, str): + kw[k] = v.replace('\\', '\\\\') self.opts.append(Opt(*arg, **kw)) -- cgit v1.2.1