- Add patch to fix build with pytest4+ (both in git of upstream):
* pytest4.patch * py2encoding.patch - Use fdupes - Update URL - Make sure py2 tests are run too OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-Whoosh?expand=0&rev=17
This commit is contained in:
parent
73f977b701
commit
ed524c01a4
57
py2encoding.patch
Normal file
57
py2encoding.patch
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
From f5a777572fb9c91fa10be3c1ffd5f65cc9323653 Mon Sep 17 00:00:00 2001
|
||||||
|
From: fortable1999 <fortable1999@gmail.com>
|
||||||
|
Date: Wed, 12 Dec 2018 11:18:50 +0900
|
||||||
|
Subject: [PATCH] Fixed test case for ListCorrector; Fixed FSA __eq__ function
|
||||||
|
|
||||||
|
---
|
||||||
|
src/whoosh/automata/fsa.py | 7 +------
|
||||||
|
tests/test_reading.py | 1 +
|
||||||
|
tests/test_spelling.py | 7 ++++++-
|
||||||
|
5 files changed, 12 insertions(+), 8 deletions(-)
|
||||||
|
create mode 100644 .gitignore
|
||||||
|
|
||||||
|
diff --git a/src/whoosh/automata/fsa.py b/src/whoosh/automata/fsa.py
|
||||||
|
index 280ddb50..54d23f2f 100644
|
||||||
|
--- a/src/whoosh/automata/fsa.py
|
||||||
|
+++ b/src/whoosh/automata/fsa.py
|
||||||
|
@@ -44,12 +44,7 @@ def __eq__(self, other):
|
||||||
|
return False
|
||||||
|
st = self.transitions
|
||||||
|
ot = other.transitions
|
||||||
|
- if list(st) != list(ot):
|
||||||
|
- return False
|
||||||
|
- for key in st:
|
||||||
|
- if st[key] != ot[key]:
|
||||||
|
- return False
|
||||||
|
- return True
|
||||||
|
+ return st == ot
|
||||||
|
|
||||||
|
def all_states(self):
|
||||||
|
stateset = set(self.transitions)
|
||||||
|
diff --git a/tests/test_reading.py b/tests/test_reading.py
|
||||||
|
index e2c2b71d..9fefc41c 100644
|
||||||
|
--- a/tests/test_reading.py
|
||||||
|
+++ b/tests/test_reading.py
|
||||||
|
@@ -1,3 +1,4 @@
|
||||||
|
+# coding=utf-8
|
||||||
|
from __future__ import with_statement
|
||||||
|
import random, threading, time
|
||||||
|
|
||||||
|
diff --git a/tests/test_spelling.py b/tests/test_spelling.py
|
||||||
|
index ce5284f1..440c2d02 100644
|
||||||
|
--- a/tests/test_spelling.py
|
||||||
|
+++ b/tests/test_spelling.py
|
||||||
|
@@ -20,7 +20,12 @@ def test_list_corrector():
|
||||||
|
corr = spelling.ListCorrector(_wordlist)
|
||||||
|
typo = "reoction"
|
||||||
|
sugs = list(corr.suggest(typo, maxdist=2))
|
||||||
|
- target = [w for w in _wordlist if levenshtein(typo, w) <= 2]
|
||||||
|
+ target = []
|
||||||
|
+ for lev_dist in range(1, 3):
|
||||||
|
+ # sugs will return suggest first ordered by levenshtein distance
|
||||||
|
+ # then second order by dictionary order
|
||||||
|
+ target += [w for w in _wordlist
|
||||||
|
+ if levenshtein(typo, w) <= lev_dist and w not in target]
|
||||||
|
assert sugs == target
|
||||||
|
|
||||||
|
|
13
pytest4.patch
Normal file
13
pytest4.patch
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
Index: Whoosh-2.7.4/setup.cfg
|
||||||
|
===================================================================
|
||||||
|
--- Whoosh-2.7.4.orig/setup.cfg
|
||||||
|
+++ Whoosh-2.7.4/setup.cfg
|
||||||
|
@@ -15,7 +15,7 @@ formats = zip,gztar
|
||||||
|
push = sdist bdist_wheel upload
|
||||||
|
pushdocs = build_sphinx upload_sphinx
|
||||||
|
|
||||||
|
-[pytest]
|
||||||
|
+[tool:pytest]
|
||||||
|
addopts = -rs --tb=native
|
||||||
|
norecursedirs = .hg .tox _build tmp* env* benchmark stress
|
||||||
|
minversion = 2.0
|
@ -1,3 +1,13 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Thu Jul 18 08:22:32 UTC 2019 - Tomáš Chvátal <tchvatal@suse.com>
|
||||||
|
|
||||||
|
- Add patch to fix build with pytest4+ (both in git of upstream):
|
||||||
|
* pytest4.patch
|
||||||
|
* py2encoding.patch
|
||||||
|
- Use fdupes
|
||||||
|
- Update URL
|
||||||
|
- Make sure py2 tests are run too
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Tue Dec 4 12:56:04 UTC 2018 - Matej Cepl <mcepl@suse.com>
|
Tue Dec 4 12:56:04 UTC 2018 - Matej Cepl <mcepl@suse.com>
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# spec file for package python-Whoosh
|
# spec file for package python-Whoosh
|
||||||
#
|
#
|
||||||
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
|
# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
|
||||||
#
|
#
|
||||||
# All modifications and additions to the file contributed by third parties
|
# All modifications and additions to the file contributed by third parties
|
||||||
# remain the property of their copyright owners, unless otherwise agreed
|
# remain the property of their copyright owners, unless otherwise agreed
|
||||||
@ -17,23 +17,23 @@
|
|||||||
|
|
||||||
|
|
||||||
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
|
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
|
||||||
%bcond_without test
|
|
||||||
Name: python-Whoosh
|
Name: python-Whoosh
|
||||||
Version: 2.7.4
|
Version: 2.7.4
|
||||||
Release: 0
|
Release: 0
|
||||||
Summary: Pure-Python full text indexing, search, and spell checking library
|
Summary: Pure-Python full text indexing, search, and spell checking library
|
||||||
License: BSD-2-Clause
|
License: BSD-2-Clause
|
||||||
Group: Development/Languages/Python
|
Group: Development/Languages/Python
|
||||||
URL: http://www.turbogears.org
|
URL: https://github.com/whoosh-community/whoosh/
|
||||||
Source: https://files.pythonhosted.org/packages/source/W/Whoosh/Whoosh-%{version}.tar.gz
|
Source: https://files.pythonhosted.org/packages/source/W/Whoosh/Whoosh-%{version}.tar.gz
|
||||||
BuildRequires: %{python_module Sphinx}
|
Patch0: pytest4.patch
|
||||||
|
Patch1: py2encoding.patch
|
||||||
BuildRequires: %{python_module setuptools}
|
BuildRequires: %{python_module setuptools}
|
||||||
|
BuildRequires: fdupes
|
||||||
BuildRequires: python-rpm-macros
|
BuildRequires: python-rpm-macros
|
||||||
|
BuildRequires: python3-Sphinx
|
||||||
BuildArch: noarch
|
BuildArch: noarch
|
||||||
# SECTION the testing dependencies
|
# SECTION the testing dependencies
|
||||||
%if %{with test}
|
|
||||||
BuildRequires: %{python_module pytest}
|
BuildRequires: %{python_module pytest}
|
||||||
%endif
|
|
||||||
# /SECTION
|
# /SECTION
|
||||||
%ifpython2
|
%ifpython2
|
||||||
Provides: python-whoosh = %{version}
|
Provides: python-whoosh = %{version}
|
||||||
@ -62,6 +62,7 @@ This package contains the documentation.
|
|||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q -n Whoosh-%{version}
|
%setup -q -n Whoosh-%{version}
|
||||||
|
%autopatch -p1
|
||||||
|
|
||||||
%build
|
%build
|
||||||
%python_build
|
%python_build
|
||||||
@ -69,11 +70,12 @@ sphinx-build -b html -d docs/build/doctrees docs/source docs/build/html
|
|||||||
|
|
||||||
%install
|
%install
|
||||||
%python_install
|
%python_install
|
||||||
|
%python_expand %fdupes %{buildroot}%{$python_sitelib}
|
||||||
|
|
||||||
%if %{with test}
|
|
||||||
%check
|
%check
|
||||||
%python_exec setup.py test
|
export LANG=en_US.UTF8
|
||||||
%endif
|
# test_list_corrector - depends on dict sorting thats in py3+ only
|
||||||
|
%pytest -k 'not test_list_corrector'
|
||||||
|
|
||||||
%files %{python_files}
|
%files %{python_files}
|
||||||
%license LICENSE.txt
|
%license LICENSE.txt
|
||||||
|
Loading…
Reference in New Issue
Block a user