diff --git a/python-rply.changes b/python-rply.changes index ca05c1e..3bc1b2c 100644 --- a/python-rply.changes +++ b/python-rply.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Sat Jan 21 18:59:12 UTC 2023 - Ben Greiner + +- Fix test suite: pytest no longer comes with py + * Add rply-pr116-pytest.patch gh#alex/rply#116 +- PEP517 build + ------------------------------------------------------------------- Fri Oct 7 15:12:10 UTC 2022 - Yogalakshmi Arunachalam diff --git a/python-rply.spec b/python-rply.spec index 4cc0b0c..56b502e 100644 --- a/python-rply.spec +++ b/python-rply.spec @@ -1,7 +1,7 @@ # # spec file for package python-rply # -# Copyright (c) 2022 SUSE LLC +# Copyright (c) 2023 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -16,7 +16,6 @@ # -%{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-rply Version: 0.7.8 Release: 0 @@ -26,7 +25,11 @@ Group: Development/Languages/Python URL: https://github.com/alex/rply # https://github.com/alex/rply/issues/90 Source: https://github.com/alex/rply/archive/v%{version}.tar.gz +# PATCH-FIX-UPSTREAM rply-pr116-pytest.patch gh#alex/rply#116 +Patch0: rply-pr116-pytest.patch +BuildRequires: %{python_module pip} BuildRequires: %{python_module setuptools} +BuildRequires: %{python_module wheel} BuildRequires: fdupes BuildRequires: python-rpm-macros Requires: python-appdirs @@ -43,13 +46,13 @@ It is a more-or-less direct port of David Beazley's PLY, with a new public API, and with RPython support. %prep -%setup -q -n rply-%{version} +%autosetup -p1 -n rply-%{version} %build -%python_build +%pyproject_wheel %install -%python_install +%pyproject_install %python_expand %fdupes %{buildroot}%{$python_sitelib} %check @@ -58,6 +61,7 @@ public API, and with RPython support. %files %{python_files} %license LICENSE %doc README.rst -%{python_sitelib}/* +%{python_sitelib}/rply +%{python_sitelib}/rply-%{version}.dist-info %changelog diff --git a/rply-pr116-pytest.patch b/rply-pr116-pytest.patch new file mode 100644 index 0000000..6204721 --- /dev/null +++ b/rply-pr116-pytest.patch @@ -0,0 +1,197 @@ +From a15a815d1237fe220bcc42932eeb0387da5939af Mon Sep 17 00:00:00 2001 +From: Ben Greiner +Date: Sat, 21 Jan 2023 20:03:36 +0100 +Subject: [PATCH 1/5] py is deprecated + +--- + tests/test_ztranslation.py | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/tests/test_ztranslation.py b/tests/test_ztranslation.py +index b4baf69..3a33ce0 100644 +--- a/tests/test_ztranslation.py ++++ b/tests/test_ztranslation.py +@@ -1,11 +1,11 @@ + import re + +-import py ++import pytest + + try: + from rpython.rtyper.test.test_llinterp import interpret + except ImportError: +- pytestmark = py.test.mark.skip("Needs RPython to be on the PYTHONPATH") ++ pytestmark = pytest.mark.skip("Needs RPython to be on the PYTHONPATH") + + from rply import LexerGenerator, ParserGenerator, Token + from rply.errors import ParserGeneratorWarning + +From c04b00c65144bfb4556616377475a9c1986fd49c Mon Sep 17 00:00:00 2001 +From: Ben Greiner +Date: Sat, 21 Jan 2023 20:04:29 +0100 +Subject: [PATCH 2/5] Update tox.ini + +--- + tox.ini | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tox.ini b/tox.ini +index 13155c8..fd45235 100644 +--- a/tox.ini ++++ b/tox.ini +@@ -6,7 +6,7 @@ deps = pytest + # just running tox with PYTHONPATH=pypy tox fails, see + # https://bitbucket.org/hpk42/tox/issue/146/setting-pythonpath-causes-tox-to-crash + setenv = PYTHONPATH={env:PYPY_LOCATION} +-commands = py.test ++commands = pytest + + [testenv:docs] + deps = sphinx + +From 8caf19f547082dc340c2891d7f6368081b74d212 Mon Sep 17 00:00:00 2001 +From: Ben Greiner +Date: Sat, 21 Jan 2023 20:07:57 +0100 +Subject: [PATCH 3/5] Update test_utils.py + +--- + tests/test_utils.py | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/tests/test_utils.py b/tests/test_utils.py +index 19e674f..9c2ab79 100644 +--- a/tests/test_utils.py ++++ b/tests/test_utils.py +@@ -1,6 +1,6 @@ + from operator import itemgetter + +-import py ++import pytest + + from rply.utils import IdentityDict + +@@ -20,7 +20,7 @@ def test_delitem(self): + x = [] + d[x] = "hello" + del d[x] +- with py.test.raises(KeyError): ++ with pytest.raises(KeyError): + d[x] + + def test_len(self): + +From 756be0670400e1dbf4a4eb5d12ced63c7cf48ecc Mon Sep 17 00:00:00 2001 +From: Ben Greiner +Date: Sat, 21 Jan 2023 20:09:12 +0100 +Subject: [PATCH 4/5] Update test_parsergenerator.py + +--- + tests/test_parsergenerator.py | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +diff --git a/tests/test_parsergenerator.py b/tests/test_parsergenerator.py +index 0316399..62e4825 100644 +--- a/tests/test_parsergenerator.py ++++ b/tests/test_parsergenerator.py +@@ -1,6 +1,6 @@ + import uuid + +-import py ++import pytest + + from rply import ParserGenerator, Token + from rply.errors import ParserGeneratorError +@@ -11,7 +11,7 @@ + class TestParserGenerator(BaseTests): + def test_production_syntax_error(self): + pg = ParserGenerator([]) +- with py.test.raises(ParserGeneratorError): ++ with pytest.raises(ParserGeneratorError): + pg.production("main VALUE") + + def test_production_terminal_overlap(self): +@@ -21,7 +21,7 @@ def test_production_terminal_overlap(self): + def x(p): + pass + +- with py.test.raises(ParserGeneratorError): ++ with pytest.raises(ParserGeneratorError): + pg.build() + + def test_duplicate_precedence(self): +@@ -29,7 +29,7 @@ def test_duplicate_precedence(self): + ("left", ["term", "term"]) + ]) + +- with py.test.raises(ParserGeneratorError): ++ with pytest.raises(ParserGeneratorError): + pg.build() + + def test_invalid_associativity(self): +@@ -37,7 +37,7 @@ def test_invalid_associativity(self): + ("to-the-left", ["term"]), + ]) + +- with py.test.raises(ParserGeneratorError): ++ with pytest.raises(ParserGeneratorError): + pg.build() + + def test_nonexistent_precedence(self): +@@ -47,7 +47,7 @@ def test_nonexistent_precedence(self): + def main(p): + pass + +- with py.test.raises(ParserGeneratorError): ++ with pytest.raises(ParserGeneratorError): + pg.build() + + def test_error_symbol(self): + +From cf76ce0c47928dc9778f44a0cd2a23a6b959798c Mon Sep 17 00:00:00 2001 +From: Ben Greiner +Date: Sat, 21 Jan 2023 20:10:12 +0100 +Subject: [PATCH 5/5] Update test_parser.py + +--- + tests/test_parser.py | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/tests/test_parser.py b/tests/test_parser.py +index 6cdf68f..51b7647 100644 +--- a/tests/test_parser.py ++++ b/tests/test_parser.py +@@ -1,6 +1,6 @@ + import operator + +-import py ++import pytest + + from rply import ParserGenerator, ParsingError, Token + from rply.errors import ParserGeneratorWarning +@@ -157,7 +157,7 @@ def main(p): + + parser = pg.build() + +- with py.test.raises(ParsingError) as exc_info: ++ with pytest.raises(ParsingError) as exc_info: + parser.parse(iter([ + Token("VALUE", "hello"), + Token("VALUE", "world", SourcePosition(5, 10, 2)), +@@ -181,7 +181,7 @@ def error_handler(token): + + token = Token("VALUE", "world") + +- with py.test.raises(ValueError) as exc_info: ++ with pytest.raises(ValueError) as exc_info: + parser.parse(iter([ + Token("VALUE", "hello"), + token +@@ -236,7 +236,7 @@ def error(state, token): + + state = ParserState() + token = Token("VALUE", "") +- with py.test.raises(ValueError) as exc_info: ++ with pytest.raises(ValueError) as exc_info: + parser.parse(iter([token]), state=state) + + assert exc_info.value.args[0] is state