patman: Correct unit tests to run correctly
It seems that doctest behaves differently now, and some of the unit tests do not run. Adjust the tests to work correctly. ./tools/patman/patman --test <unittest.result.TestResult run=10 errors=0 failures=0> Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
6ba5737ff0
commit
e752edcb6b
@ -478,13 +478,13 @@ def LookupEmail(lookup_name, alias=None, raise_on_error=True, level=0):
|
|||||||
...
|
...
|
||||||
OSError: Recursive email alias at 'other'
|
OSError: Recursive email alias at 'other'
|
||||||
>>> LookupEmail('odd', alias, raise_on_error=False)
|
>>> LookupEmail('odd', alias, raise_on_error=False)
|
||||||
\033[1;31mAlias 'odd' not found\033[0m
|
Alias 'odd' not found
|
||||||
[]
|
[]
|
||||||
>>> # In this case the loop part will effectively be ignored.
|
>>> # In this case the loop part will effectively be ignored.
|
||||||
>>> LookupEmail('loop', alias, raise_on_error=False)
|
>>> LookupEmail('loop', alias, raise_on_error=False)
|
||||||
\033[1;31mRecursive email alias at 'other'\033[0m
|
Recursive email alias at 'other'
|
||||||
\033[1;31mRecursive email alias at 'john'\033[0m
|
Recursive email alias at 'john'
|
||||||
\033[1;31mRecursive email alias at 'mary'\033[0m
|
Recursive email alias at 'mary'
|
||||||
['j.bloggs@napier.co.nz', 'm.poppins@cloud.net']
|
['j.bloggs@napier.co.nz', 'm.poppins@cloud.net']
|
||||||
"""
|
"""
|
||||||
if not alias:
|
if not alias:
|
||||||
|
@ -275,7 +275,7 @@ class PatchStream:
|
|||||||
|
|
||||||
# Suppress duplicate signoffs
|
# Suppress duplicate signoffs
|
||||||
elif signoff_match:
|
elif signoff_match:
|
||||||
if (self.is_log or
|
if (self.is_log or not self.commit or
|
||||||
self.commit.CheckDuplicateSignoff(signoff_match.group(1))):
|
self.commit.CheckDuplicateSignoff(signoff_match.group(1))):
|
||||||
out = [line]
|
out = [line]
|
||||||
|
|
||||||
@ -312,7 +312,10 @@ class PatchStream:
|
|||||||
out = []
|
out = []
|
||||||
log = self.series.MakeChangeLog(self.commit)
|
log = self.series.MakeChangeLog(self.commit)
|
||||||
out += self.FormatTags(self.tags)
|
out += self.FormatTags(self.tags)
|
||||||
out += [line] + self.commit.notes + [''] + log
|
out += [line]
|
||||||
|
if self.commit:
|
||||||
|
out += self.commit.notes
|
||||||
|
out += [''] + log
|
||||||
elif self.found_test:
|
elif self.found_test:
|
||||||
if not re_allowed_after_test.match(line):
|
if not re_allowed_after_test.match(line):
|
||||||
self.lines_after_test += 1
|
self.lines_after_test += 1
|
||||||
|
@ -30,8 +30,12 @@ class Color(object):
|
|||||||
enabled: True if color output should be enabled. If False then this
|
enabled: True if color output should be enabled. If False then this
|
||||||
class will not add color codes at all.
|
class will not add color codes at all.
|
||||||
"""
|
"""
|
||||||
|
try:
|
||||||
self._enabled = (colored == COLOR_ALWAYS or
|
self._enabled = (colored == COLOR_ALWAYS or
|
||||||
(colored == COLOR_IF_TERMINAL and os.isatty(sys.stdout.fileno())))
|
(colored == COLOR_IF_TERMINAL and
|
||||||
|
os.isatty(sys.stdout.fileno())))
|
||||||
|
except:
|
||||||
|
self._enabled = False
|
||||||
|
|
||||||
def Start(self, color, bright=True):
|
def Start(self, color, bright=True):
|
||||||
"""Returns a start color code.
|
"""Returns a start color code.
|
||||||
|
@ -55,6 +55,7 @@ This adds functions to enable/disable clocks and reset to on-chip peripherals.
|
|||||||
|
|
||||||
Signed-off-by: Simon Glass <sjg@chromium.org>
|
Signed-off-by: Simon Glass <sjg@chromium.org>
|
||||||
---
|
---
|
||||||
|
|
||||||
arch/arm/cpu/armv7/tegra2/Makefile | 2 +-
|
arch/arm/cpu/armv7/tegra2/Makefile | 2 +-
|
||||||
arch/arm/cpu/armv7/tegra2/ap20.c | 57 ++----
|
arch/arm/cpu/armv7/tegra2/ap20.c | 57 ++----
|
||||||
arch/arm/cpu/armv7/tegra2/clock.c | 163 +++++++++++++++++
|
arch/arm/cpu/armv7/tegra2/clock.c | 163 +++++++++++++++++
|
||||||
@ -200,7 +201,7 @@ index 0000000..2234c87
|
|||||||
self.assertEqual(result.errors, 0)
|
self.assertEqual(result.errors, 0)
|
||||||
self.assertEqual(result.warnings, 0)
|
self.assertEqual(result.warnings, 0)
|
||||||
self.assertEqual(result.checks, 0)
|
self.assertEqual(result.checks, 0)
|
||||||
self.assertEqual(result.lines, 67)
|
self.assertEqual(result.lines, 56)
|
||||||
os.remove(inf)
|
os.remove(inf)
|
||||||
|
|
||||||
def testNoSignoff(self):
|
def testNoSignoff(self):
|
||||||
@ -211,18 +212,18 @@ index 0000000..2234c87
|
|||||||
self.assertEqual(result.errors, 1)
|
self.assertEqual(result.errors, 1)
|
||||||
self.assertEqual(result.warnings, 0)
|
self.assertEqual(result.warnings, 0)
|
||||||
self.assertEqual(result.checks, 0)
|
self.assertEqual(result.checks, 0)
|
||||||
self.assertEqual(result.lines, 67)
|
self.assertEqual(result.lines, 56)
|
||||||
os.remove(inf)
|
os.remove(inf)
|
||||||
|
|
||||||
def testSpaces(self):
|
def testSpaces(self):
|
||||||
inf = self.SetupData('spaces')
|
inf = self.SetupData('spaces')
|
||||||
result = checkpatch.CheckPatch(inf)
|
result = checkpatch.CheckPatch(inf)
|
||||||
self.assertEqual(result.ok, False)
|
self.assertEqual(result.ok, False)
|
||||||
self.assertEqual(len(result.problems), 1)
|
self.assertEqual(len(result.problems), 2)
|
||||||
self.assertEqual(result.errors, 0)
|
self.assertEqual(result.errors, 0)
|
||||||
self.assertEqual(result.warnings, 1)
|
self.assertEqual(result.warnings, 2)
|
||||||
self.assertEqual(result.checks, 0)
|
self.assertEqual(result.checks, 0)
|
||||||
self.assertEqual(result.lines, 67)
|
self.assertEqual(result.lines, 56)
|
||||||
os.remove(inf)
|
os.remove(inf)
|
||||||
|
|
||||||
def testIndent(self):
|
def testIndent(self):
|
||||||
@ -233,7 +234,7 @@ index 0000000..2234c87
|
|||||||
self.assertEqual(result.errors, 0)
|
self.assertEqual(result.errors, 0)
|
||||||
self.assertEqual(result.warnings, 0)
|
self.assertEqual(result.warnings, 0)
|
||||||
self.assertEqual(result.checks, 1)
|
self.assertEqual(result.checks, 1)
|
||||||
self.assertEqual(result.lines, 67)
|
self.assertEqual(result.lines, 56)
|
||||||
os.remove(inf)
|
os.remove(inf)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user