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

Fix NOSE_TESTMATCH default regex. #950

merged 5 commits into from
Nov 18, 2015

Conversation

kengruven
Copy link
Contributor

See bug #11.

I don't know if this is exactly what's needed, but let's get this party started.

@tonysimpson
Copy link

@kengruven I've had a look at this - looks good. I might suggest changing the Config class docstring to include the env.get( this would seem to be the convention but with or without that change I think this needs merging ASAP - this bug is embarrassing.

@kengruven
Copy link
Contributor Author

Tony, good call. I've made the change you suggested.

@kengruven
Copy link
Contributor Author

I'm not familiar enough with nose's CI tests to understand why this failed, but it doesn't seem to have anything to do with this PR. (All I did was change a docstring!)

The Python 3.2 test failed in 'coverage', which uses a u''-style string, which isn't valid syntax on that particular version. PR #951 (completely unrelated) is failing for the same reason.

@kengruven kengruven closed this Oct 17, 2015
@kengruven kengruven reopened this Oct 17, 2015
@@ -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]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You edited this by hand, but it's a generated file. Run make -C doc readme to update it correctly.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I run that, it comes out as:

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

i.e., the backslash is missing. Is that a Sphinx bug?

Maybe that's why the original had doubled backslashes -- they were trying to get it to show up correctly in the README. Even with 4 backslashes, I can't get it to render a backslash in README.txt, though.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This helps:

diff --git a/nose/config.py b/nose/config.py
index 5997aaf..7609f35 100644
--- a/nose/config.py
+++ b/nose/config.py
@@ -499,7 +499,8 @@ class Config(object):
             dest="testMatch", metavar="REGEX",
             help="Files, directories, function names, and class names "
             "that match this regular expression are considered tests.  "
-            "Default: %s [NOSE_TESTMATCH]" % self.testMatchPat,
+            "Default: %s [NOSE_TESTMATCH]" % (
+                self.testMatchPat.replace('\\', '\\\\'),),
             default=self.testMatchPat)
         parser.add_option(
             "--tests", action="store", dest="testNames", default=None,

It means that you see a double backslash in nosetests -h though--but I don't think it's worth worrying about... it communicates what it needs to.

This fixes the top half of nosetests.1 and README.txt.
This fixes the -m flag documentation for both the README.txt and
nosetests.1 manpage.
@kengruven
Copy link
Contributor Author

OK, I've convinced myself it's not a Sphinx bug.

It's was mostly an issue with how nose's OptBucket makes text for Sphinx to parse. This should fix the backslash problem in all 5 places (top of manpage, bottom of manpage, top of README, bottom of README, -h flag). I re-ran make -C doc clean and make -C doc readme man to re-generate those files.

It's not the prettiest thing I've ever written, and I'm not terribly familiar with the Nose internals, so improvements are welcome.

@jszakmeister
Copy link
Contributor

Looks good. Thanks.

jszakmeister added a commit that referenced this pull request Nov 18, 2015
Fix NOSE_TESTMATCH default regex.
@jszakmeister jszakmeister merged commit 7c8f005 into nose-devs:master Nov 18, 2015
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants