From 3527320b24e2fe01da9f5e5c1750bf8715578a95 Mon Sep 17 00:00:00 2001 From: Radek Novacek Date: Thu, 1 Nov 2012 11:17:23 +0100 Subject: [PATCH] Enable tests in %check --- python-enchant-1.6.5-fix-docstring-test.patch | 13 ++++++++++ ...on-enchant-1.6.5-fix-tests-without-X.patch | 17 ++++++++++++ python-enchant.spec | 26 ++++++++++++++++++- 3 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 python-enchant-1.6.5-fix-docstring-test.patch create mode 100644 python-enchant-1.6.5-fix-tests-without-X.patch diff --git a/python-enchant-1.6.5-fix-docstring-test.patch b/python-enchant-1.6.5-fix-docstring-test.patch new file mode 100644 index 0000000..273acd5 --- /dev/null +++ b/python-enchant-1.6.5-fix-docstring-test.patch @@ -0,0 +1,13 @@ +diff -up pyenchant-1.6.5/enchant/tests.py.fix-docstring-test pyenchant-1.6.5/enchant/tests.py +--- pyenchant-1.6.5/enchant/tests.py.fix-docstring-test 2012-11-01 09:39:36.268616326 +0100 ++++ pyenchant-1.6.5/enchant/tests.py 2012-11-01 09:40:54.037488976 +0100 +@@ -414,7 +414,8 @@ class TestDocStrings(unittest.TestCase): + "dictwithpwl","skippable","dicts","dict's","filenames", + "trie","api","ctypes","wxspellcheckerdialog","stateful", + "cmdlinechecker","spellchecks","callback","clunkier","iterator", +- "ispell","cor","backends"] ++ "ispell","cor","backends", "incant", "runtime", "subclasses", ++ "initialise"] + + def test_docstrings(self): + """Test that all our docstrings are error-free.""" diff --git a/python-enchant-1.6.5-fix-tests-without-X.patch b/python-enchant-1.6.5-fix-tests-without-X.patch new file mode 100644 index 0000000..2f4cff7 --- /dev/null +++ b/python-enchant-1.6.5-fix-tests-without-X.patch @@ -0,0 +1,17 @@ +diff -up pyenchant-1.6.5/enchant/tests.py.fix-tests-without-X pyenchant-1.6.5/enchant/tests.py +--- pyenchant-1.6.5/enchant/tests.py.fix-tests-without-X 2012-11-01 08:54:43.261512454 +0100 ++++ pyenchant-1.6.5/enchant/tests.py 2012-11-01 09:01:12.184938020 +0100 +@@ -427,11 +427,11 @@ class TestDocStrings(unittest.TestCase): + import enchant.checker.CmdLineChecker + try: + import enchant.checker.GtkSpellCheckerDialog +- except ImportError: ++ except (ImportError, RuntimeError): + pass + try: + import enchant.checker.wxSpellCheckerDialog +- except ImportError: ++ except (ImportError, RuntimeError): + pass + errors = [] + # Naive recursion here would blow the stack, instead we diff --git a/python-enchant.spec b/python-enchant.spec index b15803d..63d15ca 100644 --- a/python-enchant.spec +++ b/python-enchant.spec @@ -2,7 +2,7 @@ Name: python-enchant Version: 1.6.5 -Release: 8%{?dist} +Release: 9%{?dist} Summary: Python bindings for Enchant spellchecking library Group: Development/Languages @@ -11,17 +11,24 @@ URL: http://packages.python.org/pyenchant/ Source0: http://pypi.python.org/packages/source/p/pyenchant/pyenchant-%{version}.tar.gz BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) +Patch0: python-enchant-1.6.5-fix-tests-without-X.patch +Patch1: python-enchant-1.6.5-fix-docstring-test.patch + BuildArch: noarch BuildRequires: enchant-devel # Python 2 build requirements: BuildRequires: python2-devel BuildRequires: python-setuptools >= 0:0.6a9 +# For running tests +BuildRequires: python-nose # Python 3 build requirements: %if 0%{?with_python3} BuildRequires: python3-devel BuildRequires: python3-setuptools >= 0:0.6a9 +# For running tests +BuildRequires: python3-nose %endif # if with_python3 # Work around a problem with libenchant versioning @@ -49,6 +56,8 @@ library by Dom Lachowicz. %prep %setup -q -n pyenchant-%{version} +%patch0 -p1 -b .fix-tests-without-X +%patch1 -p1 -b .fix-docstring-test %if 0%{?with_python3} rm -rf %{py3dir} @@ -84,6 +93,18 @@ rm -rf $RPM_BUILD_ROOT/%{python_sitelib}/*.egg-info rm -rf $RPM_BUILD_ROOT/%{python_sitelib}/enchant/lib rm -rf $RPM_BUILD_ROOT/%{python_sitelib}/enchant/share +%check +pushd $RPM_BUILD_ROOT/%{python_sitelib} +# There is no dictionary for language C, need to use en_US +LANG=en_US.UTF-8 /usr/bin/nosetests +popd + +%if 0%{?with_python3} +pushd $RPM_BUILD_ROOT/%{python3_sitelib} +# There is no dictionary for language C, need to use en_US +LANG=en_US.UTF-8 /usr/bin/nosetests-3* +popd +%endif # with python3 %clean rm -rf $RPM_BUILD_ROOT @@ -120,6 +141,9 @@ rm -rf $RPM_BUILD_ROOT %changelog +* Thu Nov 01 2012 Radek Novacek 1.6.5-9 +- Enable tests in %check + * Wed Oct 31 2012 Radek Novacek 1.6.5-8 - Fix upstream url and source url