aboutsummaryrefslogtreecommitdiffstats
path: root/tests/plugins.py
diff options
context:
space:
mode:
authorWaylan Limberg <waylan.limberg@icloud.com>2014-11-20 16:07:03 -0500
committerWaylan Limberg <waylan.limberg@icloud.com>2014-11-20 16:07:03 -0500
commit8f66a94eab1389d97041944ed24afd2bf7c4389c (patch)
tree10b53664076650be951468cbbb163f3d637e5891 /tests/plugins.py
parent0c2143819ef7de53be52f7a4d47e027ff194a9b4 (diff)
downloadmarkdown-8f66a94eab1389d97041944ed24afd2bf7c4389c.tar.gz
markdown-8f66a94eab1389d97041944ed24afd2bf7c4389c.tar.bz2
markdown-8f66a94eab1389d97041944ed24afd2bf7c4389c.zip
Flake8 cleanup (mostly whitespace).
Got all but a couple files in the tests (ran out of time today). Apparently I have been using some bad form for years (although a few things seemed to look better before the update). Anyway, conformant now.
Diffstat (limited to 'tests/plugins.py')
-rw-r--r--tests/plugins.py50
1 files changed, 28 insertions, 22 deletions
diff --git a/tests/plugins.py b/tests/plugins.py
index 12bac55..90c5c0d 100644
--- a/tests/plugins.py
+++ b/tests/plugins.py
@@ -9,9 +9,11 @@ class MarkdownSyntaxError(Exception):
class Markdown(ErrorClassPlugin):
""" Add MarkdownSyntaxError and ensure proper formatting. """
- mdsyntax = ErrorClass(MarkdownSyntaxError,
- label='MarkdownSyntaxError',
- isfailure=True)
+ mdsyntax = ErrorClass(
+ MarkdownSyntaxError,
+ label='MarkdownSyntaxError',
+ isfailure=True
+ )
enabled = True
def configure(self, options, conf):
@@ -39,28 +41,30 @@ def escape(html):
class HtmlOutput(Plugin):
"""Output test results as ugly, unstyled html. """
-
+
name = 'html-output'
- score = 2 # run late
+ score = 2 # run late
enabled = True
-
+
def __init__(self):
super(HtmlOutput, self).__init__()
- self.html = [ '<html><head>',
- '<title>Test output</title>',
- '</head><body>' ]
-
+ self.html = [
+ '<html><head>',
+ '<title>Test output</title>',
+ '</head><body>'
+ ]
+
def configure(self, options, conf):
self.conf = conf
def addSuccess(self, test):
self.html.append('<span>ok</span>')
-
+
def addError(self, test, err):
err = self.formatErr(err)
self.html.append('<span>ERROR</span>')
self.html.append('<pre>%s</pre>' % escape(err))
-
+
def addFailure(self, test, err):
err = self.formatErr(err)
self.html.append('<span>FAIL</span>')
@@ -68,9 +72,10 @@ class HtmlOutput(Plugin):
def finalize(self, result):
self.html.append('<div>')
- self.html.append("Ran %d test%s" %
- (result.testsRun, result.testsRun != 1 and "s"
-or ""))
+ self.html.append(
+ "Ran %d test%s" %
+ (result.testsRun, result.testsRun != 1 and "s" or "")
+ )
self.html.append('</div>')
self.html.append('<div>')
if not result.wasSuccessful():
@@ -93,7 +98,7 @@ or ""))
def formatErr(self, err):
exctype, value, tb = err
return ''.join(traceback.format_exception(exctype, value, tb))
-
+
def startContext(self, ctx):
try:
n = ctx.__name__
@@ -108,12 +113,13 @@ or ""))
def stopContext(self, ctx):
self.html.append('</fieldset>')
-
+
def startTest(self, test):
- self.html.extend([ '<div><span>',
- test.shortDescription() or str(test),
- '</span>' ])
-
+ self.html.extend([
+ '<div><span>',
+ test.shortDescription() or str(test),
+ '</span>'
+ ])
+
def stopTest(self, test):
self.html.append('</div>')
-