File rply-pr116-pytest.patch of Package python-rply
From a15a815d1237fe220bcc42932eeb0387da5939af Mon Sep 17 00:00:00 2001
From: Ben Greiner <code@bnavigator.de>
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 <code@bnavigator.de>
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 <code@bnavigator.de>
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 <code@bnavigator.de>
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 <code@bnavigator.de>
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