1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
|
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
--
2.40.1
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
--
2.40.1
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 @@ class TestIdentityDict(object):
x = []
d[x] = "hello"
del d[x]
- with py.test.raises(KeyError):
+ with pytest.raises(KeyError):
d[x]
def test_len(self):
--
2.40.1
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 @@ from .base import BaseTests
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 @@ class TestParserGenerator(BaseTests):
def x(p):
pass
- with py.test.raises(ParserGeneratorError):
+ with pytest.raises(ParserGeneratorError):
pg.build()
def test_duplicate_precedence(self):
@@ -29,7 +29,7 @@ class TestParserGenerator(BaseTests):
("left", ["term", "term"])
])
- with py.test.raises(ParserGeneratorError):
+ with pytest.raises(ParserGeneratorError):
pg.build()
def test_invalid_associativity(self):
@@ -37,7 +37,7 @@ class TestParserGenerator(BaseTests):
("to-the-left", ["term"]),
])
- with py.test.raises(ParserGeneratorError):
+ with pytest.raises(ParserGeneratorError):
pg.build()
def test_nonexistent_precedence(self):
@@ -47,7 +47,7 @@ class TestParserGenerator(BaseTests):
def main(p):
pass
- with py.test.raises(ParserGeneratorError):
+ with pytest.raises(ParserGeneratorError):
pg.build()
def test_error_symbol(self):
--
2.40.1
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 @@ class TestParser(BaseTests):
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 @@ class TestParser(BaseTests):
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 @@ class TestParser(BaseTests):
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
--
2.40.1
|