From 1178a8249e7fe4c5ce83471c79e3f4e1df5e40d1 Mon Sep 17 00:00:00 2001 From: Nils Philippsen Date: Tue, 2 Jul 2024 17:23:21 +0200 Subject: [PATCH] Fix testing with pytest 8 Resolves: rhbz#2293924 Signed-off-by: Nils Philippsen --- python-rdflib.spec | 2 ++ rdflib-7.0.0-pytest8.patch | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 rdflib-7.0.0-pytest8.patch diff --git a/python-rdflib.spec b/python-rdflib.spec index 7a18a64..81cff4b 100644 --- a/python-rdflib.spec +++ b/python-rdflib.spec @@ -17,6 +17,8 @@ BuildArch: noarch Source: %{pypi_source} Patch: %{srcname}-py3_13-fix-pickler.diff +# Backported from https://github.com/RDFLib/rdflib/pull/2817 +Patch: rdflib-7.0.0-pytest8.patch BuildRequires: python%{python3_pkgversion}-devel %if %{with tests} diff --git a/rdflib-7.0.0-pytest8.patch b/rdflib-7.0.0-pytest8.patch new file mode 100644 index 0000000..9a052f3 --- /dev/null +++ b/rdflib-7.0.0-pytest8.patch @@ -0,0 +1,35 @@ +diff -up rdflib-7.0.0/test/test_misc/test_parse_file_guess_format.py.pytest8 rdflib-7.0.0/test/test_misc/test_parse_file_guess_format.py +--- rdflib-7.0.0/test/test_misc/test_parse_file_guess_format.py.pytest8 2023-06-01 21:15:21.520171900 +0200 ++++ rdflib-7.0.0/test/test_misc/test_parse_file_guess_format.py 2024-07-02 17:45:47.257339626 +0200 +@@ -61,7 +61,7 @@ class TestFileParserGuessFormat: + g.parse(os.path.join(TEST_DATA_DIR, "example-lots_of_graphs.n3")), Graph + ) + +- def test_warning(self) -> None: ++ def test_warning(self, caplog: pytest.LogCaptureFixture) -> None: + g = Graph() + graph_logger = logging.getLogger("rdflib") + +@@ -78,9 +78,16 @@ class TestFileParserGuessFormat: + ), + str(newpath), + ) +- with pytest.raises(ParserError, match=r"Could not guess RDF format"): +- with pytest.warns( +- UserWarning, +- match="does not look like a valid URI, trying to serialize this will break.", +- ) as logwarning: +- g.parse(str(newpath)) ++ with pytest.raises( ++ ParserError, match=r"Could not guess RDF format" ++ ), caplog.at_level("WARNING"): ++ g.parse(str(newpath)) ++ ++ assert any( ++ rec.levelno == logging.WARNING ++ and ( ++ "does not look like a valid URI, trying to serialize this will break." ++ in rec.message ++ ) ++ for rec in caplog.records ++ )