Fixed test for the continue run
This commit is contained in:
parent
8d90591b33
commit
7f2dd74ae9
|
@ -91,26 +91,6 @@ class ReprFailDoctest(TerminalRepr):
|
||||||
reprlocation.toterminal(tw)
|
reprlocation.toterminal(tw)
|
||||||
|
|
||||||
|
|
||||||
# class DoctestFailureContainer(object):
|
|
||||||
#
|
|
||||||
# NAME = 'DocTestFailure'
|
|
||||||
#
|
|
||||||
# def __init__(self, test, example, got):
|
|
||||||
# self.test = test
|
|
||||||
# self.example = example
|
|
||||||
# self.got = got
|
|
||||||
#
|
|
||||||
#
|
|
||||||
# class DoctestUnexpectedExceptionContainer(object):
|
|
||||||
#
|
|
||||||
# NAME = 'DoctestUnexpectedException'
|
|
||||||
#
|
|
||||||
# def __init__(self, test, example, exc_info):
|
|
||||||
# self.test = test
|
|
||||||
# self.example = example
|
|
||||||
# self.exc_info = exc_info
|
|
||||||
|
|
||||||
|
|
||||||
class MultipleDoctestFailures(Exception):
|
class MultipleDoctestFailures(Exception):
|
||||||
def __init__(self, failures):
|
def __init__(self, failures):
|
||||||
super(MultipleDoctestFailures, self).__init__()
|
super(MultipleDoctestFailures, self).__init__()
|
||||||
|
@ -138,7 +118,6 @@ def _init_runner_class():
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def report_failure(self, out, test, example, got):
|
def report_failure(self, out, test, example, got):
|
||||||
# failure = DoctestFailureContainer(test, example, got)
|
|
||||||
failure = doctest.DocTestFailure(test, example, got)
|
failure = doctest.DocTestFailure(test, example, got)
|
||||||
if self.continue_on_failure:
|
if self.continue_on_failure:
|
||||||
out.append(failure)
|
out.append(failure)
|
||||||
|
@ -146,7 +125,6 @@ def _init_runner_class():
|
||||||
raise failure
|
raise failure
|
||||||
|
|
||||||
def report_unexpected_exception(self, out, test, example, exc_info):
|
def report_unexpected_exception(self, out, test, example, exc_info):
|
||||||
# failure = DoctestUnexpectedExceptionContainer(test, example, exc_info)
|
|
||||||
failure = doctest.UnexpectedException(test, example, exc_info)
|
failure = doctest.UnexpectedException(test, example, exc_info)
|
||||||
if self.continue_on_failure:
|
if self.continue_on_failure:
|
||||||
out.append(failure)
|
out.append(failure)
|
||||||
|
|
|
@ -769,11 +769,13 @@ class TestDoctestSkips(object):
|
||||||
""")
|
""")
|
||||||
result = testdir.runpytest("--doctest-modules")
|
result = testdir.runpytest("--doctest-modules")
|
||||||
result.assert_outcomes(passed=0, failed=1)
|
result.assert_outcomes(passed=0, failed=1)
|
||||||
# We need to make sure we have two failure lines (4, 5, and 8) instead of
|
# The lines that contains the failure are 4, 5, and 8. The first one
|
||||||
# one.
|
# is a stack trace and the other two are mismatches.
|
||||||
result.stdout.fnmatch_lines("*test_something.txt:4: DoctestUnexpectedException*")
|
result.stdout.fnmatch_lines([
|
||||||
result.stdout.fnmatch_lines("*test_something.txt:5: DocTestFailure*")
|
"*4: UnexpectedException*",
|
||||||
result.stdout.fnmatch_lines("*test_something.txt:8: DocTestFailure*")
|
"*5: DocTestFailure*",
|
||||||
|
"*8: DocTestFailure*",
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
class TestDoctestAutoUseFixtures(object):
|
class TestDoctestAutoUseFixtures(object):
|
||||||
|
|
Loading…
Reference in New Issue