-
Notifications
You must be signed in to change notification settings - Fork 29.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tools: expose skip output to test runner #2130
Changes from 4 commits
ea2fa68
b673537
de4e4d0
3014572
4d6b0b5
9cd5da6
3749544
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,6 +49,7 @@ | |
from Queue import Queue, Empty | ||
|
||
logger = logging.getLogger('testrunner') | ||
is_skipped = re.compile(r"# SKIP\S+ (.+)", re.IGNORECASE) | ||
|
||
VERBOSE = False | ||
|
||
|
@@ -255,6 +256,9 @@ def HasRun(self, output): | |
logger.info('#' + l) | ||
for l in output.output.stdout.splitlines(): | ||
logger.info('#' + l) | ||
elif output.HasSkipped(): | ||
skip = is_skipped.findall(output.output.stdout) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there a reason to use else:
match = re.match(r'# SKIP\S*\s+(.*)', output.output.stdout, re.IGNORECASE)
if match:
logger.info('ok %i - %s # skip %s' % (self._done, command, match.group(1)))
else:
logger.info('ok %i - %s' % (self._done, command)) Minor aside: if you want to keep the regex separate, maybe rename There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @bnoordhuis +1. It is Pythonic :-) I would still compile the RegEx with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @bnoordhuis the reason i went with |
||
logger.info('ok %i - %s # skip %s' % (self._done, command, skip[0])) | ||
else: | ||
logger.info('ok %i - %s' % (self._done, command)) | ||
|
||
|
@@ -471,6 +475,10 @@ def UnexpectedOutput(self): | |
outcome = PASS | ||
return not outcome in self.test.outcomes | ||
|
||
def HasSkipped(self): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: It is not pythonic to have a method name starting with a capital letter. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Followed the conventions already established in test.py. Wasn't very keen on rewriting them all? |
||
skip = is_skipped.search(self.output.stdout) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just a question, since I am about to touch this code too, where is the "# SKIP" output generated? Is it logged to stdout by the tests themselves? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @orangemocha PTAL at #2109 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, the tests print There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Got it, thanks! |
||
return self.store_unexpected_output and skip | ||
|
||
def HasPreciousOutput(self): | ||
return self.UnexpectedOutput() and self.store_unexpected_output | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you use single quotes? By the way, the "official" regular expression is
# SKIP\S*\s+(.*)
.