From ba803777cd42712f3b327cada0f4e688346e09ea Mon Sep 17 00:00:00 2001 From: Balaji Veeramani Date: Mon, 12 Jun 2023 17:29:49 -0700 Subject: [PATCH] Revert "Make `SKIP` behave like `MOCK` (#3)" This reverts commit 77ea9227f63849b39d8b4c71bf08892e3dd86998. Signed-off-by: Balaji Veeramani --- src/pytest_sphinx.py | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/pytest_sphinx.py b/src/pytest_sphinx.py index a6fee4e..d65ea11 100644 --- a/src/pytest_sphinx.py +++ b/src/pytest_sphinx.py @@ -433,6 +433,10 @@ def _DocTestRunner__run( else: self.optionflags &= ~optionflag + # If 'SKIP' is set, then skip this example. + if self.optionflags & doctest.SKIP: + continue + # Record that we started this example. tries += 1 if not quiet: @@ -467,17 +471,9 @@ def _DocTestRunner__run( # If the example executed without raising any exceptions, # verify its output. if exception is None: - # If 'SKIP' is set, run the example code but don't check the - # output. This is different than upstream `pytest-sphinx`, which skips - # the example entirely. - if self.optionflags & doctest.SKIP: + # If 'MOCK' is set, then don't check the output. + if self.optionflags & _MOCK: outcome = SUCCESS - - # 'MOCK' is deprecated in favor of 'SKIP'. Here for backwards - # compatibility. - elif self.optionflags & _MOCK: - outcome = SUCCESS - elif check(example.want, got, self.optionflags): outcome = SUCCESS