From a60c0a55c53c9ab65f1b7764f3508afe2dbabdede6b46e2e541e8c8f642fe566 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Chv=C3=A1tal?= Date: Fri, 10 Jul 2020 13:55:31 +0000 Subject: [PATCH] Accepting request 819991 from home:pgajdos:python - switch from nose to pytest - added patches fix https://github.com/formencode/formencode/pull/154 + python-FormEncode-remove-nose.patch OBS-URL: https://build.opensuse.org/request/show/819991 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-FormEncode?expand=0&rev=24 --- python-FormEncode-remove-nose.patch | 172 ++++++++++++++++++++++++++++ python-FormEncode.changes | 8 ++ python-FormEncode.spec | 9 +- 3 files changed, 186 insertions(+), 3 deletions(-) create mode 100644 python-FormEncode-remove-nose.patch diff --git a/python-FormEncode-remove-nose.patch b/python-FormEncode-remove-nose.patch new file mode 100644 index 0000000..23e6551 --- /dev/null +++ b/python-FormEncode-remove-nose.patch @@ -0,0 +1,172 @@ +Index: FormEncode-1.3.1/formencode/tests/test_context.py +=================================================================== +--- FormEncode-1.3.1.orig/formencode/tests/test_context.py 2020-07-10 13:21:48.125612252 +0200 ++++ FormEncode-1.3.1/formencode/tests/test_context.py 2020-07-10 14:11:53.460309142 +0200 +@@ -1,55 +1,55 @@ + from __future__ import absolute_import +-from nose.tools import assert_raises ++import unittest + + from formencode.context import Context, ContextRestoreError + + c1 = Context(default=None) + c2 = Context() + ++class TestContext(unittest.TestCase): + +-def test_one(): +- state = c1.set(foo=1) +- assert_is(c1, 'foo', 1) +- state.restore() +- assert_is(c1, 'foo', None) +- state = c1.set(foo=2) +- state2 = c2.set(foo='test') +- assert_is(c1, 'foo', 2) +- assert_is(c2, 'foo', 'test') +- change_state(c1, assert_is, c1, 'foo', 3, foo=3) +- assert_is(c1, 'foo', 2) +- state.restore() +- state2.restore() +- +- +-def change_state(context, func, *args, **change): +- state = context.set(**change) +- try: +- return func(*args) +- finally: ++ def change_state(self, context, func, *args, **change): ++ state = context.set(**change) ++ try: ++ return func(*args) ++ finally: ++ state.restore() ++ ++ def assert_is(self, ob, attr, value): ++ assert getattr(ob, attr) == value ++ ++ ++ def test_fail(self): ++ c3 = Context() ++ res1 = c3.set(a=1) ++ res2 = c3.set(b=2) ++ with self.assertRaises(ContextRestoreError): ++ res1.restore() ++ assert c3.b == 2 ++ assert c3.a == 1 ++ res2.restore() ++ res1.restore() ++ ++ def test_default(self): ++ con = Context() ++ res = con.set(a=2) ++ con.set_default(a=4, b=1) ++ assert con.b == 1 ++ assert con.a == 2 ++ res.restore() ++ assert con.a == 4 ++ ++ def test_one(self): ++ state = c1.set(foo=1) ++ self.assert_is(c1, 'foo', 1) + state.restore() ++ self.assert_is(c1, 'foo', None) ++ state = c1.set(foo=2) ++ state2 = c2.set(foo='test') ++ self.assert_is(c1, 'foo', 2) ++ self.assert_is(c2, 'foo', 'test') ++ self.change_state(c1, self.assert_is, c1, 'foo', 3, foo=3) ++ self.assert_is(c1, 'foo', 2) ++ state.restore() ++ state2.restore() + +- +-def test_fail(): +- c3 = Context() +- res1 = c3.set(a=1) +- res2 = c3.set(b=2) +- assert_raises(ContextRestoreError, res1.restore) +- assert c3.b == 2 +- assert c3.a == 1 +- res2.restore() +- res1.restore() +- +- +-def assert_is(ob, attr, value): +- assert getattr(ob, attr) == value +- +- +-def test_default(): +- con = Context() +- res = con.set(a=2) +- con.set_default(a=4, b=1) +- assert con.b == 1 +- assert con.a == 2 +- res.restore() +- assert con.a == 4 +Index: FormEncode-1.3.1/formencode/tests/test_validators.py +=================================================================== +--- FormEncode-1.3.1.orig/formencode/tests/test_validators.py 2020-07-10 13:21:48.125612252 +0200 ++++ FormEncode-1.3.1/formencode/tests/test_validators.py 2020-07-10 14:12:08.540402950 +0200 +@@ -4,7 +4,6 @@ from __future__ import unicode_literals + + import datetime + import unittest +-from nose.plugins.skip import SkipTest + + from formencode import validators + from formencode.validators import Invalid +Index: FormEncode-1.3.1/FormEncode.egg-info/requires.txt +=================================================================== +--- FormEncode-1.3.1.orig/FormEncode.egg-info/requires.txt 2016-08-09 04:22:09.000000000 +0200 ++++ FormEncode-1.3.1/FormEncode.egg-info/requires.txt 2020-07-10 14:14:06.917139411 +0200 +@@ -1,5 +1,4 @@ + + [testing] +-nose + pycountry + dnspython +Index: FormEncode-1.3.1/formencode/tests/test_doctests.py +=================================================================== +--- FormEncode-1.3.1.orig/formencode/tests/test_doctests.py 2020-07-10 13:21:48.125612252 +0200 ++++ FormEncode-1.3.1/formencode/tests/test_doctests.py 2020-07-10 14:15:09.813530701 +0200 +@@ -66,7 +66,7 @@ def doctest_module(document, verbose, ra + + + def set_func_description(fn, description): +- """Wrap function and set description attr for nosetests to display.""" ++ """Wrap function and set description attr to display.""" + def _wrapper(*a_test_args): + fn(*a_test_args) + _wrapper.description = description +@@ -75,7 +75,6 @@ def set_func_description(fn, description + + def test_doctests(): + """Generate each doctest.""" +- # TODO Can we resolve this from nose? + verbose = False + raise_error = True + for document in text_files + modules: +Index: FormEncode-1.3.1/setup.cfg +=================================================================== +--- FormEncode-1.3.1.orig/setup.cfg 2016-08-09 04:22:10.000000000 +0200 ++++ FormEncode-1.3.1/setup.cfg 2020-07-10 14:13:28.028897479 +0200 +@@ -1,6 +1,3 @@ +-[nosetests] +-detailed-errors = 1 +- + [compile_catalog] + domain = FormEncode + directory = formencode/i18n +Index: FormEncode-1.3.1/setup.py +=================================================================== +--- FormEncode-1.3.1.orig/setup.py 2020-07-10 13:21:48.129612276 +0200 ++++ FormEncode-1.3.1/setup.py 2020-07-10 14:13:43.116991345 +0200 +@@ -15,7 +15,7 @@ version = '1.3.1' + if not '2.6' <= sys.version < '3.0' and not '3.2' <= sys.version: + raise ImportError('Python version not supported') + +-tests_require = ['nose', 'pycountry', ++tests_require = ['pycountry', + 'dnspython' if sys.version < '3.0' else 'dnspython3'] + + doctests = ['docs/htmlfill.txt', 'docs/Validator.txt', diff --git a/python-FormEncode.changes b/python-FormEncode.changes index 895bc69..d217a55 100644 --- a/python-FormEncode.changes +++ b/python-FormEncode.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Fri Jul 10 12:51:17 UTC 2020 - pgajdos@suse.com + +- switch from nose to pytest +- added patches + fix https://github.com/formencode/formencode/pull/154 + + python-FormEncode-remove-nose.patch + ------------------------------------------------------------------- Thu Mar 7 11:09:21 UTC 2019 - Tomáš Chvátal diff --git a/python-FormEncode.spec b/python-FormEncode.spec index d7e964e..ad2402a 100644 --- a/python-FormEncode.spec +++ b/python-FormEncode.spec @@ -1,7 +1,7 @@ # # spec file for package python-FormEncode # -# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2020 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -29,9 +29,11 @@ Source: https://files.pythonhosted.org/packages/source/F/FormEncode/Form Patch0: remove-online-tests.patch Patch1: new-pycountry.patch Patch2: six.patch +# https://github.com/formencode/formencode/pull/154 +Patch3: python-FormEncode-remove-nose.patch BuildRequires: %{python_module dnspython} -BuildRequires: %{python_module nose} BuildRequires: %{python_module pycountry} +BuildRequires: %{python_module pytest} BuildRequires: %{python_module setuptools} BuildRequires: %{python_module six} BuildRequires: dos2unix @@ -57,6 +59,7 @@ for filling and generating forms. %patch0 -p1 %patch1 -p1 %patch2 -p1 +%patch3 -p1 dos2unix README.rst %build @@ -73,7 +76,7 @@ dos2unix README.rst %check export LANG=en_US.UTF-8 # excluded tests poll dns -%python_expand PYTHONPATH=%{buildroot}%{$python_sitelib} nosetests-%{$python_bin_suffix} -v -e '(test_cyrillic_email|test_unicode_ascii_subgroup)' formencode/tests +%pytest -k 'not (test_cyrillic_email or test_unicode_ascii_subgroup)' formencode/tests %files %{python_files} %doc README.rst