From 381687df55fda715a87395f7ffba1c91428650e2 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Fri, 17 Dec 2021 10:16:06 -0300 Subject: [PATCH] Fix tests for pytest 7.0 compatibility The `path` attribute of `Traceback` objects is now `pathlib.Path`. This changes the affected code so it will work with pytest 7.0 and previous versions too. --- tests/test_extra.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_extra.py b/tests/test_extra.py index 4a08371..b983d07 100644 --- a/tests/test_extra.py +++ b/tests/test_extra.py @@ -113,7 +113,7 @@ def throws(v): with raises(AssertionError) as assert_exc: p3.get() - assert assert_exc.traceback[-1].path.strpath == __file__ + assert str(assert_exc.traceback[-1].path) == __file__ def test_thrown_exceptions_preserve_stacktrace(): @@ -127,7 +127,7 @@ def after_throws(v): with raises(AssertionError) as assert_exc: p3.get() - assert assert_exc.traceback[-1].path.strpath == __file__ + assert str(assert_exc.traceback[-1].path) == __file__ # WAIT