Skip to content

Commit 6315a56

Browse files
authored
Merge pull request #349 from Yelp/py313-tests
fix tests for python 3.13
2 parents 18fc97b + b4df67f commit 6315a56

File tree

4 files changed

+12
-13
lines changed

4 files changed

+12
-13
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
main:
1111
strategy:
1212
matrix:
13-
python: ['3.10', '3.11', '3.12']
13+
python: ['3.10', '3.11', '3.12', '3.13']
1414
runs-on: ubuntu-latest
1515
steps:
1616
- uses: actions/checkout@v3

requirements-dev.txt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22

33
covdefaults>=2.1
44
coverage
5-
lxml
6-
pre-commit
7-
pylint
85
pytest
6+
re-assert
97
setuptools
108
wheel

tests/NameMapper_test.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,11 @@ def test_VFNS_dict(vfns):
7373

7474
@vffns_tests
7575
def test_VFFNS_locals_first(vffns):
76-
loc = object()
77-
glob = object()
78-
ns_var = object()
76+
loc = mock.sentinel.loc
77+
glob = mock.sentinel.glob
78+
ns_var = mock.sentinel.ns_var
7979
# Intentionally mask builtin `int`
80-
locals().update({'int': loc})
80+
int = loc
8181
with mock.patch.dict(globals(), {'int': glob}):
8282
assert vffns('int', locals(), globals(), {'int': ns_var}) is loc
8383

tests/compile_test.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import textwrap
55

66
import pytest
7+
import re_assert
78

89
from Cheetah.compile import _create_module_from_source
910
from Cheetah.compile import compile_file
@@ -157,14 +158,14 @@ def test_compile_to_class_traceback():
157158
raise AssertionError("Should raise ZeroDivision")
158159

159160
# The current implementation doesn't show the line of code which caused the exception:
160-
import re
161-
assert re.match(
161+
re_assert.Matches(
162162
r'''Traceback \(most recent call last\):
163163
File ".+/tests/compile_test\.py", line \d*, in test_compile_to_class_traceback
164-
ret\(\).respond\(\)
164+
ret\(\).respond\(\)(?:
165+
+~+\^+)?
165166
File "<generated cheetah module>", line \d*, in respond
166-
ZeroDivisionError: (integer )?division( or modulo)? by zero''', traceback,
167-
)
167+
ZeroDivisionError: division by zero''',
168+
).assert_matches(traceback)
168169

169170

170171
def test_compile_is_deterministic():

0 commit comments

Comments
 (0)