From 8b4178f9e561a9b9fa6d450e90f95957b6a8704423336a7dcb9e203012399ea4 Mon Sep 17 00:00:00 2001 From: Steve Kowalik Date: Mon, 27 Sep 2021 04:28:29 +0000 Subject: [PATCH] - Add patch remove-nose.patch * Stop using nose.tools. - Use pytest rather than setup.py test OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-phply?expand=0&rev=8 --- python-phply.changes | 7 +++++ python-phply.spec | 10 ++++--- remove-nose.patch | 69 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 82 insertions(+), 4 deletions(-) create mode 100644 remove-nose.patch diff --git a/python-phply.changes b/python-phply.changes index 4475e56..68db89d 100644 --- a/python-phply.changes +++ b/python-phply.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Mon Sep 27 04:27:24 UTC 2021 - Steve Kowalik + +- Add patch remove-nose.patch + * Stop using nose.tools. +- Use pytest rather than setup.py test + ------------------------------------------------------------------- Wed May 20 07:26:13 UTC 2020 - Petr Gajdos diff --git a/python-phply.spec b/python-phply.spec index 4de6b07..dd2a4cb 100644 --- a/python-phply.spec +++ b/python-phply.spec @@ -1,7 +1,7 @@ # # spec file for package python-phply # -# Copyright (c) 2020 SUSE LLC +# Copyright (c) 2021 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -25,14 +25,15 @@ License: BSD-3-Clause Group: Development/Languages/Python URL: https://github.com/viraptor/phply Source: https://files.pythonhosted.org/packages/source/p/phply/phply-%{version}.tar.gz -BuildRequires: %{python_module nose} +Patch0: remove-nose.patch BuildRequires: %{python_module ply} +BuildRequires: %{python_module pytest} BuildRequires: %{python_module setuptools} BuildRequires: fdupes BuildRequires: python-rpm-macros Requires: python-ply Requires(post): update-alternatives -Requires(postun): update-alternatives +Requires(postun):update-alternatives BuildArch: noarch %python_subpackages @@ -41,6 +42,7 @@ phply is a parser for the PHP programming language written using PLY, a Lex/YACC %prep %setup -q -n phply-%{version} +%autopatch -p1 %build %python_build @@ -53,7 +55,7 @@ phply is a parser for the PHP programming language written using PLY, a Lex/YACC %python_expand rm -rf %{buildroot}%{$python_sitelib}/tests %check -%python_exec setup.py test +%pytest %post %python_install_alternative phpparse diff --git a/remove-nose.patch b/remove-nose.patch new file mode 100644 index 0000000..a309b6d --- /dev/null +++ b/remove-nose.patch @@ -0,0 +1,69 @@ +Index: phply-1.2.5/tests/test_filtered_lexer.py +=================================================================== +--- phply-1.2.5.orig/tests/test_filtered_lexer.py ++++ phply-1.2.5/tests/test_filtered_lexer.py +@@ -2,7 +2,6 @@ from __future__ import print_function + + from phply import phplex + +-import nose.tools + import pprint + + def eq_tokens(input, expected, ignore=('WHITESPACE', 'OPEN_TAG', 'CLOSE_TAG')): +@@ -23,7 +22,7 @@ def eq_tokens(input, expected, ignore=(' + print('Token by token:') + for out, exp in zip(output, expected): + print('\tgot:', out, '\texpected:', exp) +- nose.tools.eq_(out, exp) ++ assert out == exp + + assert len(output) == len(expected), \ + 'output length was %d, expected %s' % (len(output), len(expected)) +Index: phply-1.2.5/tests/test_lexer.py +=================================================================== +--- phply-1.2.5.orig/tests/test_lexer.py ++++ phply-1.2.5/tests/test_lexer.py +@@ -2,7 +2,6 @@ from __future__ import print_function + + from phply import phplex + +-import nose.tools + import pprint + + def eq_tokens(input, expected, ignore=('WHITESPACE', 'OPEN_TAG', 'CLOSE_TAG')): +@@ -23,7 +22,7 @@ def eq_tokens(input, expected, ignore=(' + print('Token by token:') + for out, exp in zip(output, expected): + print('\tgot:', out, '\texpected:', exp) +- nose.tools.eq_(out, exp) ++ assert out == exp + + assert len(output) == len(expected), \ + 'output length was %d, expected %s' % (len(output), len(expected)) +Index: phply-1.2.5/tests/test_parser.py +=================================================================== +--- phply-1.2.5.orig/tests/test_parser.py ++++ phply-1.2.5/tests/test_parser.py +@@ -4,7 +4,6 @@ from phply import phplex + from phply.phpparse import make_parser + from phply.phpast import * + +-import nose.tools + import pprint + import sys + +@@ -23,12 +22,12 @@ def eq_ast(input, expected, filename=Non + print('Node by node:') + for out, exp in zip(output, expected): + print('\tgot:', out, '\texpected:', exp) +- nose.tools.eq_(out, exp) ++ assert out == exp + + # compare line numbers, but only for top elements + if with_top_lineno: + print('\tgot line:', out.lineno, '\texpected:', exp.lineno) +- nose.tools.eq_(out.lineno, exp.lineno) ++ assert out.lineno == exp.lineno + + assert len(output) == len(expected), \ + 'output length was %d, expected %s' % (len(output), len(expected))