diff options
author | Michał Górny <mgorny@gentoo.org> | 2024-04-02 16:06:22 +0200 |
---|---|---|
committer | Michał Górny <mgorny@gentoo.org> | 2024-04-02 18:18:28 +0200 |
commit | 1cf80c25fdea65c399018f856f430fe208e95294 (patch) | |
tree | f3d32ea35edb6ea2a87dd2e530758b4609eb2789 /dev-python/fastjsonschema | |
parent | dev-qt/qtmultimedia: skip tst_backends (qt6) (diff) | |
download | gentoo-1cf80c25fdea65c399018f856f430fe208e95294.tar.gz gentoo-1cf80c25fdea65c399018f856f430fe208e95294.tar.bz2 gentoo-1cf80c25fdea65c399018f856f430fe208e95294.zip |
dev-python/fastjsonschema: Backport pytest-8 fix
Closes: https://bugs.gentoo.org/928408
Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'dev-python/fastjsonschema')
-rw-r--r-- | dev-python/fastjsonschema/fastjsonschema-2.19.1.ebuild | 5 | ||||
-rw-r--r-- | dev-python/fastjsonschema/files/fastjsonschema-2.19.1-pytest-8.patch | 67 |
2 files changed, 72 insertions, 0 deletions
diff --git a/dev-python/fastjsonschema/fastjsonschema-2.19.1.ebuild b/dev-python/fastjsonschema/fastjsonschema-2.19.1.ebuild index 602928a877f2..2308e701735e 100644 --- a/dev-python/fastjsonschema/fastjsonschema-2.19.1.ebuild +++ b/dev-python/fastjsonschema/fastjsonschema-2.19.1.ebuild @@ -23,3 +23,8 @@ distutils_enable_tests pytest EPYTEST_IGNORE=( tests/benchmarks ) + +PATCHES=( + # https://github.com/horejsek/python-fastjsonschema/pull/180 + "${FILESDIR}/${P}-pytest-8.patch" +) diff --git a/dev-python/fastjsonschema/files/fastjsonschema-2.19.1-pytest-8.patch b/dev-python/fastjsonschema/files/fastjsonschema-2.19.1-pytest-8.patch new file mode 100644 index 000000000000..40cd057f6299 --- /dev/null +++ b/dev-python/fastjsonschema/files/fastjsonschema-2.19.1-pytest-8.patch @@ -0,0 +1,67 @@ +From 427a34e9ef409fefd8f1f7ae7e1c2a2bb7eb4496 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Edgar=20Ram=C3=ADrez=20Mondrag=C3=B3n?= + <edgarrm358@gmail.com> +Date: Tue, 14 Nov 2023 18:05:17 -0600 +Subject: [PATCH] Use `warnings.catch_warnings` instead of `pytest.warns(None)` + in tests + +--- + tests/test_pattern_properties.py | 7 ++++--- + tests/test_string.py | 7 ++++--- + 2 files changed, 8 insertions(+), 6 deletions(-) + +diff --git a/tests/test_pattern_properties.py b/tests/test_pattern_properties.py +index ae86946..945315b 100644 +--- a/tests/test_pattern_properties.py ++++ b/tests/test_pattern_properties.py +@@ -1,3 +1,5 @@ ++import warnings ++ + import pytest + + +@@ -59,12 +61,11 @@ def test_pattern_with_escape_no_warnings(asserter): + 'bar': {} + } + +- with pytest.warns(None) as record: ++ with warnings.catch_warnings(): ++ warnings.simplefilter("error") + asserter({ + 'type': 'object', + 'patternProperties': { + '\\w+': {'type': 'object'} + } + }, value, value) +- +- assert len(record) == 0 +diff --git a/tests/test_string.py b/tests/test_string.py +index a8e8318..12fc3c9 100644 +--- a/tests/test_string.py ++++ b/tests/test_string.py +@@ -1,3 +1,5 @@ ++import warnings ++ + import pytest + + from fastjsonschema import JsonSchemaValueException +@@ -74,14 +76,13 @@ def test_pattern_with_space(asserter, pattern): + + + def test_pattern_with_escape_no_warnings(asserter): +- with pytest.warns(None) as record: ++ with warnings.catch_warnings(): ++ warnings.simplefilter("error") + asserter({ + 'type': 'string', + 'pattern': '\\s' + }, ' ', ' ') + +- assert len(record) == 0 +- + + exc = JsonSchemaValueException('data must be a valid regex', value='{data}', name='data', definition='{definition}', rule='format') + @pytest.mark.parametrize('value, expected', [ +-- +2.44.0 + |