1
0

- 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
This commit is contained in:
Matej Cepl 2019-11-01 12:49:51 +00:00 committed by Git OBS Bridge
parent d2ae58a9c7
commit 1f142b9741
3 changed files with 76 additions and 2 deletions

66
pytest4.patch Normal file
View File

@ -0,0 +1,66 @@
From 53d56bd2c6080280798b021c596c9d783ad832dc Mon Sep 17 00:00:00 2001
From: Stanislav Levin <slev@altlinux.org>
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 <slev@altlinux.org>
---
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]

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Fri Nov 1 13:49:17 CET 2019 - Matej Cepl <mcepl@suse.com>
- 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 <tchvatal@suse.com>

View File

@ -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