From 1f142b9741f64d174dfbf2c3f392b6e1f8354c34b3a6ac83c0801ba49dd631ea Mon Sep 17 00:00:00 2001 From: Matej Cepl Date: Fri, 1 Nov 2019 12:49:51 +0000 Subject: [PATCH] - Add pytest4.patch from gh#olemb/dbfread#33 which makes the test suite to pass with PyTest 4. OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-dbfread?expand=0&rev=10 --- pytest4.patch | 66 ++++++++++++++++++++++++++++++++++++++++++ python-dbfread.changes | 6 ++++ python-dbfread.spec | 6 ++-- 3 files changed, 76 insertions(+), 2 deletions(-) create mode 100644 pytest4.patch diff --git a/pytest4.patch b/pytest4.patch new file mode 100644 index 0000000..61840c2 --- /dev/null +++ b/pytest4.patch @@ -0,0 +1,66 @@ +From 53d56bd2c6080280798b021c596c9d783ad832dc Mon Sep 17 00:00:00 2001 +From: Stanislav Levin +Date: Wed, 29 May 2019 12:01:38 +0300 +Subject: [PATCH] Fix Pytest4.x compatibility errors + +The next two errors were fixed: +``` +[pytest] sections in setup.cfg files should now be named [tool:pytest] to +avoid conflicts with other distutils commands. +``` + +``` +Calling a fixture function directly, as opposed to request them in a test +function, is deprecated. +``` + +Signed-off-by: Stanislav Levin +--- + dbfread/test_read_and_length.py | 22 +++++++++++----------- + setup.cfg | 2 +- + 2 files changed, 12 insertions(+), 12 deletions(-) + +--- a/dbfread/test_read_and_length.py ++++ b/dbfread/test_read_and_length.py +@@ -24,19 +24,19 @@ deleted_records = [{u'NAME': u'Deleted G + u'BIRTHDATE': datetime.date(1979, 12, 22), + u'MEMO': u'Deleted Guy memo'}] + +-def test_len(): +- assert len(table()) == 2 +- assert len(table().deleted) == 1 ++def test_len(table, loaded_table): ++ assert len(table) == 2 ++ assert len(table.deleted) == 1 + +- assert len(loaded_table()) == 2 +- assert len(loaded_table().deleted) == 1 ++ assert len(loaded_table) == 2 ++ assert len(loaded_table.deleted) == 1 + +-def test_list(): +- assert list(table()) == records +- assert list(table().deleted) == deleted_records ++def test_list(table, loaded_table): ++ assert list(table) == records ++ assert list(table.deleted) == deleted_records + +- assert list(loaded_table()) == records +- assert list(loaded_table().deleted) == deleted_records ++ assert list(loaded_table) == records ++ assert list(loaded_table.deleted) == deleted_records + + # This should not return old style table which was a subclass of list. +- assert not isinstance(table(), list) ++ assert not isinstance(table, list) +--- a/setup.cfg ++++ b/setup.cfg +@@ -3,7 +3,7 @@ universal = 1 + + [easy_install] + +-[pytest] ++[tool:pytest] + norecursedirs = build dist examples + + [egg_info] diff --git a/python-dbfread.changes b/python-dbfread.changes index 05e6c50..d7bb678 100644 --- a/python-dbfread.changes +++ b/python-dbfread.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Fri Nov 1 13:49:17 CET 2019 - Matej Cepl + +- Add pytest4.patch from gh#olemb/dbfread#33 which makes the test + suite to pass with PyTest 4. + ------------------------------------------------------------------- Thu Aug 22 14:02:42 UTC 2019 - Tomáš Chvátal diff --git a/python-dbfread.spec b/python-dbfread.spec index 0e87125..5b2af33 100644 --- a/python-dbfread.spec +++ b/python-dbfread.spec @@ -25,7 +25,9 @@ License: MIT Group: Development/Languages/Python URL: https://github.com/olemb/dbfread Source: https://files.pythonhosted.org/packages/source/d/dbfread/dbfread-%{version}.tar.gz -BuildRequires: %{python_module pytest < 4} +# gh#olemb/dbfread#33 +Patch0: pytest4.patch +BuildRequires: %{python_module pytest} BuildRequires: %{python_module setuptools} BuildRequires: fdupes BuildRequires: python-rpm-macros @@ -39,7 +41,7 @@ Python data types for further processing. It is primarily intended for batch jobs and one-off scripts. %prep -%setup -q -n dbfread-%{version} +%autosetup -p1 -n dbfread-%{version} %build %python_build