From 7f2dd74ae9ba23cc8c8a33e933b87df9bf708be0 Mon Sep 17 00:00:00 2001 From: William Lee Date: Fri, 23 Feb 2018 21:20:14 -0600 Subject: [PATCH] Fixed test for the continue run --- _pytest/doctest.py | 22 ---------------------- testing/test_doctest.py | 12 +++++++----- 2 files changed, 7 insertions(+), 27 deletions(-) diff --git a/_pytest/doctest.py b/_pytest/doctest.py index 1345d5868..1c16f4c84 100644 --- a/_pytest/doctest.py +++ b/_pytest/doctest.py @@ -91,26 +91,6 @@ class ReprFailDoctest(TerminalRepr): 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): def __init__(self, failures): super(MultipleDoctestFailures, self).__init__() @@ -138,7 +118,6 @@ def _init_runner_class(): pass def report_failure(self, out, test, example, got): - # failure = DoctestFailureContainer(test, example, got) failure = doctest.DocTestFailure(test, example, got) if self.continue_on_failure: out.append(failure) @@ -146,7 +125,6 @@ def _init_runner_class(): raise failure def report_unexpected_exception(self, out, test, example, exc_info): - # failure = DoctestUnexpectedExceptionContainer(test, example, exc_info) failure = doctest.UnexpectedException(test, example, exc_info) if self.continue_on_failure: out.append(failure) diff --git a/testing/test_doctest.py b/testing/test_doctest.py index 8c8f45224..931279820 100644 --- a/testing/test_doctest.py +++ b/testing/test_doctest.py @@ -769,11 +769,13 @@ class TestDoctestSkips(object): """) result = testdir.runpytest("--doctest-modules") result.assert_outcomes(passed=0, failed=1) - # We need to make sure we have two failure lines (4, 5, and 8) instead of - # one. - result.stdout.fnmatch_lines("*test_something.txt:4: DoctestUnexpectedException*") - result.stdout.fnmatch_lines("*test_something.txt:5: DocTestFailure*") - result.stdout.fnmatch_lines("*test_something.txt:8: DocTestFailure*") + # The lines that contains the failure are 4, 5, and 8. The first one + # is a stack trace and the other two are mismatches. + result.stdout.fnmatch_lines([ + "*4: UnexpectedException*", + "*5: DocTestFailure*", + "*8: DocTestFailure*", + ]) class TestDoctestAutoUseFixtures(object):