15
0
forked from pool/python-phply

Accepting request 921553 from devel:languages:python

- Add patch remove-nose.patch
  * Stop using nose.tools.
- Use pytest rather than setup.py test

OBS-URL: https://build.opensuse.org/request/show/921553
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-phply?expand=0&rev=4
This commit is contained in:
2021-09-30 21:42:58 +00:00
committed by Git OBS Bridge
3 changed files with 82 additions and 4 deletions

View File

@@ -1,3 +1,10 @@
-------------------------------------------------------------------
Mon Sep 27 04:27:24 UTC 2021 - Steve Kowalik <steven.kowalik@suse.com>
- 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 <pgajdos@suse.com>

View File

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

69
remove-nose.patch Normal file
View File

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