forked from pool/python-json_tricks
- Add patch support-pytest-8.patch:
* Do not use pytest.warns(None). OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-json_tricks?expand=0&rev=30
This commit is contained in:
23
.gitattributes
vendored
Normal file
23
.gitattributes
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
## Default LFS
|
||||
*.7z filter=lfs diff=lfs merge=lfs -text
|
||||
*.bsp filter=lfs diff=lfs merge=lfs -text
|
||||
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
||||
*.gem filter=lfs diff=lfs merge=lfs -text
|
||||
*.gz filter=lfs diff=lfs merge=lfs -text
|
||||
*.jar filter=lfs diff=lfs merge=lfs -text
|
||||
*.lz filter=lfs diff=lfs merge=lfs -text
|
||||
*.lzma filter=lfs diff=lfs merge=lfs -text
|
||||
*.obscpio filter=lfs diff=lfs merge=lfs -text
|
||||
*.oxt filter=lfs diff=lfs merge=lfs -text
|
||||
*.pdf filter=lfs diff=lfs merge=lfs -text
|
||||
*.png filter=lfs diff=lfs merge=lfs -text
|
||||
*.rpm filter=lfs diff=lfs merge=lfs -text
|
||||
*.tbz filter=lfs diff=lfs merge=lfs -text
|
||||
*.tbz2 filter=lfs diff=lfs merge=lfs -text
|
||||
*.tgz filter=lfs diff=lfs merge=lfs -text
|
||||
*.ttf filter=lfs diff=lfs merge=lfs -text
|
||||
*.txz filter=lfs diff=lfs merge=lfs -text
|
||||
*.whl filter=lfs diff=lfs merge=lfs -text
|
||||
*.xz filter=lfs diff=lfs merge=lfs -text
|
||||
*.zip filter=lfs diff=lfs merge=lfs -text
|
||||
*.zst filter=lfs diff=lfs merge=lfs -text
|
||||
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
.osc
|
||||
3
pyjson_tricks-3.17.3.tar.gz
Normal file
3
pyjson_tricks-3.17.3.tar.gz
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:31370786fb199e05cf599318a5619de83b403a3bc8c68657e65e586dd499d4c7
|
||||
size 42677
|
||||
88
python-json_tricks.changes
Normal file
88
python-json_tricks.changes
Normal file
@@ -0,0 +1,88 @@
|
||||
-------------------------------------------------------------------
|
||||
Mon Aug 19 05:46:38 UTC 2024 - Steve Kowalik <steven.kowalik@suse.com>
|
||||
|
||||
- Add patch support-pytest-8.patch:
|
||||
* Do not use pytest.warns(None).
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Dec 7 22:24:21 UTC 2023 - Dirk Müller <dmueller@suse.com>
|
||||
|
||||
- update to 3.17.3:
|
||||
* drop python 2 support
|
||||
* datetime fixes
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Sat Jun 17 18:40:58 UTC 2023 - Christian Boltz <suse-beta@cboltz.de>
|
||||
|
||||
- Update to 3.17.1
|
||||
* no upstream changelog
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue May 16 18:39:56 UTC 2023 - Christian Boltz <suse-beta@cboltz.de>
|
||||
|
||||
- Update to 3.16.1
|
||||
* no upstream changelog
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Jul 14 17:58:22 UTC 2022 - Ben Greiner <code@bnavigator.de>
|
||||
|
||||
- Remove ancient pathlib requirement for python3. It is part of the
|
||||
stdlib since Python 3.4
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Apr 19 06:34:11 UTC 2021 - Steve Kowalik <steven.kowalik@suse.com>
|
||||
|
||||
- Update to 3.15.5:
|
||||
* Attempt py3.9 support
|
||||
* Allow none as encoder class for dump(s), for compatibility
|
||||
* Fix Numpy Array with shape (0,N) not decoded correctly.
|
||||
- Do not build for Python 3.6, due to no NumPy.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Apr 20 11:42:47 UTC 2020 - Tomáš Chvátal <tchvatal@suse.com>
|
||||
|
||||
- Fix build without python2
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Apr 16 11:38:33 UTC 2020 - pgajdos@suse.com
|
||||
|
||||
- version update to 3.15.2
|
||||
* Deprecation warning ignore_comments
|
||||
* Fix the code and tests for python2
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Apr 6 06:40:33 UTC 2020 - Tomáš Chvátal <tchvatal@suse.com>
|
||||
|
||||
- Update to 3.15.0:
|
||||
* no upstream changelog
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Sep 5 13:58:59 UTC 2019 - Todd R <toddrme2178@gmail.com>
|
||||
|
||||
- Update to 3.13.2:
|
||||
* Move the version number to a Python file
|
||||
* Tests failed because type of error had changed
|
||||
* Add json_tricks.__version__
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Mar 26 14:53:58 UTC 2019 - Tomáš Chvátal <tchvatal@suse.com>
|
||||
|
||||
- Update to 3.13.1:
|
||||
* add support for pathlib
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Dec 4 12:49:40 UTC 2018 - Matej Cepl <mcepl@suse.com>
|
||||
|
||||
- Remove superfluous devel dependency for noarch package
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Aug 7 15:28:52 UTC 2018 - toddrme2178@gmail.com
|
||||
|
||||
- Update to 3.12.2
|
||||
* Fix for unterminated string exception in object containing
|
||||
empty string
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Sat May 26 23:14:51 UTC 2018 - toddrme2178@gmail.com
|
||||
|
||||
- Initial version
|
||||
76
python-json_tricks.spec
Normal file
76
python-json_tricks.spec
Normal file
@@ -0,0 +1,76 @@
|
||||
#
|
||||
# spec file for package python-json_tricks
|
||||
#
|
||||
# Copyright (c) 2024 SUSE LLC
|
||||
#
|
||||
# All modifications and additions to the file contributed by third parties
|
||||
# remain the property of their copyright owners, unless otherwise agreed
|
||||
# upon. The license for this file, and modifications and additions to the
|
||||
# file, is the same license as for the pristine package itself (unless the
|
||||
# license for the pristine package is not an Open Source License, in which
|
||||
# case the license is the MIT License). An "Open Source License" is a
|
||||
# license that conforms to the Open Source Definition (Version 1.9)
|
||||
# published by the Open Source Initiative.
|
||||
|
||||
# Please submit bugfixes or comments via https://bugs.opensuse.org/
|
||||
#
|
||||
|
||||
|
||||
Name: python-json_tricks
|
||||
Version: 3.17.3
|
||||
Release: 0
|
||||
Summary: Extra features for Python's JSON
|
||||
License: BSD-3-Clause
|
||||
URL: https://github.com/mverleg/pyjson_tricks
|
||||
Source: https://github.com/mverleg/pyjson_tricks/archive/v%{version}.tar.gz#/pyjson_tricks-%{version}.tar.gz
|
||||
# PATCH-FIX-UPSTREAM gh#mverleg/pyjson_tricks#102
|
||||
Patch0: support-pytest-8.patch
|
||||
BuildRequires: %{python_module pip}
|
||||
BuildRequires: %{python_module wheel}
|
||||
BuildRequires: fdupes
|
||||
BuildRequires: python-rpm-macros
|
||||
Recommends: python-numpy
|
||||
Recommends: python-pandas
|
||||
Recommends: python-pytz
|
||||
BuildArch: noarch
|
||||
# SECTION test requirements
|
||||
BuildRequires: %{python_module numpy}
|
||||
BuildRequires: %{python_module pandas}
|
||||
BuildRequires: %{python_module pytest}
|
||||
BuildRequires: %{python_module pytz}
|
||||
# /SECTION
|
||||
%python_subpackages
|
||||
|
||||
%description
|
||||
The json_tricks package brings several pieces of functionality to
|
||||
python handling of json files:
|
||||
|
||||
1. Store and load numpy arrays in human-readable format.
|
||||
2. Store and load class instances both generic and customized.
|
||||
3. Store and load date/times as a dictionary (including timezone).
|
||||
4. Preserve map order {} using OrderedDict.
|
||||
5. Allow for comments in json files by starting lines with #.
|
||||
6. Sets, complex numbers, Decimal, Fraction, enums, compression, duplicate keys, ...
|
||||
|
||||
As well as compression and disallowing duplicate keys.
|
||||
|
||||
%prep
|
||||
%autosetup -p1 -n pyjson_tricks-%{version}
|
||||
|
||||
%build
|
||||
%pyproject_wheel
|
||||
|
||||
%install
|
||||
%pyproject_install
|
||||
%python_expand %fdupes %{buildroot}%{$python_sitelib}
|
||||
|
||||
%check
|
||||
%pytest
|
||||
|
||||
%files %{python_files}
|
||||
%doc README.md
|
||||
%license LICENSE.txt
|
||||
%{python_sitelib}/json_tricks
|
||||
%{python_sitelib}/json_tricks-%{version}.dist-info
|
||||
|
||||
%changelog
|
||||
101
support-pytest-8.patch
Normal file
101
support-pytest-8.patch
Normal file
@@ -0,0 +1,101 @@
|
||||
From 487af357083fa87cc50adcecb08c48c6c9637284 Mon Sep 17 00:00:00 2001
|
||||
From: Steve Kowalik <steven@wedontsleep.org>
|
||||
Date: Mon, 19 Aug 2024 15:39:25 +1000
|
||||
Subject: [PATCH] Do not use warns(None) to check for no warnings
|
||||
|
||||
warns(None) is an anti-pattern, and is explicitly forbidden starting
|
||||
from pytest 8.0. Instead, we catch all warnings, and filter them to be
|
||||
errors, so they will raise an (uncaught) exception. Drive-by importing
|
||||
warns from pytest rather than the internal name.
|
||||
---
|
||||
tests/test_bare.py | 24 ++++++++++--------------
|
||||
tests/test_np.py | 8 ++++----
|
||||
2 files changed, 14 insertions(+), 18 deletions(-)
|
||||
|
||||
diff --git a/tests/test_bare.py b/tests/test_bare.py
|
||||
index d8ca447..a3c67c9 100644
|
||||
--- a/tests/test_bare.py
|
||||
+++ b/tests/test_bare.py
|
||||
@@ -10,10 +10,10 @@
|
||||
from math import pi, exp
|
||||
from os.path import join
|
||||
from tempfile import mkdtemp
|
||||
+from warnings import catch_warnings, simplefilter
|
||||
|
||||
import pytest
|
||||
-from _pytest.recwarn import warns
|
||||
-from pytest import raises, fail
|
||||
+from pytest import raises, fail, warns
|
||||
|
||||
from json_tricks import fallback_ignore_unknown, DuplicateJsonKeyException
|
||||
from json_tricks.nonp import strip_comments, dump, dumps, load, loads, \
|
||||
@@ -168,33 +168,29 @@ def test_ignore_comments_deprecation():
|
||||
loads(test_json_with_comments)
|
||||
|
||||
# Second time there should be no warning
|
||||
- # noinspection PyTypeChecker
|
||||
- with warns(None) as captured:
|
||||
+ with catch_warnings():
|
||||
+ simplefilter("error")
|
||||
loaded = loads(test_json_with_comments)
|
||||
- assert len(captured) == 0
|
||||
assert loaded == test_object_for_comment_strings
|
||||
|
||||
# Passing a string without comments should not have a warning
|
||||
loads._ignore_comments_warned_ = False
|
||||
- # noinspection PyTypeChecker
|
||||
- with warns(None) as captured:
|
||||
+ with catch_warnings():
|
||||
+ simplefilter("error")
|
||||
loaded = loads(test_json_without_comments)
|
||||
- assert len(captured) == 0
|
||||
|
||||
# Passing True for argument explicitly should not have a warning
|
||||
loads._ignore_comments_warned_ = False
|
||||
- # noinspection PyTypeChecker
|
||||
- with warns(None) as captured:
|
||||
+ with catch_warnings():
|
||||
+ simplefilter("error")
|
||||
loaded = loads(test_json_with_comments, ignore_comments=True)
|
||||
- assert len(captured) == 0
|
||||
assert loaded == test_object_for_comment_strings
|
||||
|
||||
# Passing False for argument explicitly should not have a warning
|
||||
loads._ignore_comments_warned_ = False
|
||||
- # noinspection PyTypeChecker
|
||||
- with warns(None) as captured:
|
||||
+ with catch_warnings():
|
||||
+ simplefilter("error")
|
||||
loaded = loads(test_json_without_comments, ignore_comments=False)
|
||||
- assert len(captured) == 0
|
||||
assert loaded == test_object_for_comment_strings
|
||||
|
||||
|
||||
diff --git a/tests/test_np.py b/tests/test_np.py
|
||||
index 29eb07b..4e28393 100644
|
||||
--- a/tests/test_np.py
|
||||
+++ b/tests/test_np.py
|
||||
@@ -5,8 +5,9 @@
|
||||
from os.path import join
|
||||
from tempfile import mkdtemp
|
||||
import sys
|
||||
+from warnings import catch_warnings, simplefilter
|
||||
|
||||
-from _pytest.recwarn import warns
|
||||
+from pytest import warns
|
||||
from numpy import arange, ones, array, array_equal, finfo, iinfo, pi
|
||||
from numpy import int8, int16, int32, int64, uint8, uint16, uint32, uint64, \
|
||||
float16, float32, float64, complex64, complex128, zeros, ndindex
|
||||
@@ -217,10 +218,9 @@ def test_compact_mode_unspecified():
|
||||
data = [array([[1.0, 2.0, 3.0, 4.0], [5.0, 6.0, 7.0, 8.0]]), array([pi, exp(1)])]
|
||||
with warns(JsonTricksDeprecation):
|
||||
gz_json_1 = dumps(data, compression=True)
|
||||
- # noinspection PyTypeChecker
|
||||
- with warns(None) as captured:
|
||||
+ with catch_warnings():
|
||||
+ simplefilter("error")
|
||||
gz_json_2 = dumps(data, compression=True)
|
||||
- assert len(captured) == 0
|
||||
assert gz_json_1 == gz_json_2
|
||||
json = gzip_decompress(gz_json_1).decode('ascii')
|
||||
assert json == '[{"__ndarray__": [[1.0, 2.0, 3.0, 4.0], [5.0, 6.0, 7.0, 8.0]], "dtype": "float64", "shape": [2, 4], "Corder": true}, ' \
|
||||
Reference in New Issue
Block a user