python-sybil/pytest74.patch
Dirk Mueller cadbc5782c Accepting request 1100616 from home:mcalabkova:branches:devel:languages:python:pytest
Please note: The newest version is currently 5.0.3. Version 4.0.0 was heavily 
rewritten, there are some not-yet-packaged test dependencies. I am just lazy 
to create new packages, so making a little step with small changes (which
suffice to fix the build with new pytest).

- Update to 3.0.1
  * Continue with the ever shifting sands of pytest APIs, this time 
    appeasing warnings from pytest 7 that when fixed break compatibility 
    with pytest 6.
- Drop python-sybil-fix-ordering.diff
- Add pytest74.patch to support pytest 7.4

OBS-URL: https://build.opensuse.org/request/show/1100616
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-sybil?expand=0&rev=32
2023-07-26 06:43:55 +00:00

44 lines
1.6 KiB
Diff

From df0d221c1d9da1454a5ef7fd72675d8d43b96eb0 Mon Sep 17 00:00:00 2001
From: Chris Withers <chris@simplistix.co.uk>
Date: Tue, 4 Jul 2023 18:54:22 +0100
Subject: [PATCH] Deal with more pytest internals changing
---
.circleci/config.yml | 3 ++-
sybil/integration/pytest.py | 22 +++++++++++++++++-----
2 files changed, 19 insertions(+), 6 deletions(-)
diff --git a/sybil/integration/pytest.py b/sybil/integration/pytest.py
index b32062d..8529771 100644
--- a/sybil/integration/pytest.py
+++ b/sybil/integration/pytest.py
@@ -78,11 +78,23 @@ def setup(self):
def runtest(self):
self.example.evaluate()
- def _prunetraceback(self, excinfo):
- tb = excinfo.traceback.cut(path=example_module_path)
- tb = tb[1]
- if getattr(tb, '_rawentry', None) is not None:
- excinfo.traceback = Traceback(tb._rawentry, excinfo)
+ if PYTEST_VERSION >= (7, 4, 0):
+
+ def _traceback_filter(self, excinfo: ExceptionInfo[BaseException]) -> Traceback:
+ traceback = excinfo.traceback
+ tb = traceback.cut(path=example_module_path)
+ tb = tb[1]
+ if getattr(tb, '_rawentry', None) is not None:
+ traceback = Traceback(tb._rawentry)
+ return traceback
+
+ else:
+
+ def _prunetraceback(self, excinfo):
+ tb = excinfo.traceback.cut(path=example_module_path)
+ tb = tb[1]
+ if getattr(tb, '_rawentry', None) is not None:
+ excinfo.traceback = Traceback(tb._rawentry, excinfo)
def repr_failure(
self,