From ab05cc10dba68fe87b749834d70a440db5e894e1 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Aug 25 2019 21:25:43 +0000 Subject: Patch tests to work with pyparsing 2.4. --- diff --git a/0001-Fix-tests-against-pyparsing-2.4.patch b/0001-Fix-tests-against-pyparsing-2.4.patch new file mode 100644 index 0000000..426cad6 --- /dev/null +++ b/0001-Fix-tests-against-pyparsing-2.4.patch @@ -0,0 +1,65 @@ +From 661eb7a6a6f803f996882c42850a30705436523e Mon Sep 17 00:00:00 2001 +From: Elliott Sales de Andrade +Date: Sun, 25 Aug 2019 17:22:26 -0400 +Subject: [PATCH] Fix tests against pyparsing 2.4+. + +Signed-off-by: Elliott Sales de Andrade +--- + test_snuggs.py | 18 ++++++------------ + 1 file changed, 6 insertions(+), 12 deletions(-) + +diff --git a/test_snuggs.py b/test_snuggs.py +index dfeae26..3d3e2a4 100644 +--- a/test_snuggs.py ++++ b/test_snuggs.py +@@ -192,13 +192,11 @@ def test_masked_arr(): + + # Parse and syntax error testing. + def test_missing_closing_paren(): +- with pytest.raises(SyntaxError) as excinfo: ++ with pytest.raises(SyntaxError, ++ match=r'Expected {Forward: .+ \| Forward: .+}') as excinfo: + snuggs.eval("(+ 1 2") + assert excinfo.value.lineno == 1 + assert excinfo.value.offset == 7 +- exception_options = ['expected a function or operator', +- 'Expected {Forward: ... | Forward: ...}'] +- assert str(excinfo.value) in exception_options + + + def test_missing_func(): +@@ -210,13 +208,11 @@ def test_missing_func(): + + + def test_missing_func2(): +- with pytest.raises(SyntaxError) as excinfo: ++ with pytest.raises(SyntaxError, ++ match=r'Expected {Forward: .+ \| Forward: .+}') as excinfo: + snuggs.eval("(# 1 2)") + assert excinfo.value.lineno == 1 + assert excinfo.value.offset == 2 +- exception_options = ['expected a function or operator', +- 'Expected {Forward: ... | Forward: ...}'] +- assert str(excinfo.value) in exception_options + + + def test_undefined_var(): +@@ -228,13 +224,11 @@ def test_undefined_var(): + + + def test_bogus_higher_order_func(): +- with pytest.raises(SyntaxError) as excinfo: ++ with pytest.raises(SyntaxError, ++ match=r'Expected {Forward: .+ \| Forward: .+}') as excinfo: + snuggs.eval("((bogus * 2) 2)") + assert excinfo.value.lineno == 1 + assert excinfo.value.offset == 3 +- exception_options = ['expected a function or operator', +- 'Expected {Forward: ... | Forward: ...}'] +- assert str(excinfo.value) in exception_options + + + def test_type_error(): +-- +2.21.0 + diff --git a/python-snuggs.spec b/python-snuggs.spec index c58de53..0ed1355 100644 --- a/python-snuggs.spec +++ b/python-snuggs.spec @@ -8,6 +8,8 @@ Summary: Snuggs are S-expressions for Numpy License: MIT URL: https://github.com/mapbox/snuggs Source0: %pypi_source +# https://github.com/mapbox/snuggs/issues/15 +Patch0001: 0001-Fix-tests-against-pyparsing-2.4.patch BuildArch: noarch @@ -34,7 +36,7 @@ BuildRequires: python3-hypothesis %prep -%autosetup -n %{srcname}-%{version} +%autosetup -n %{srcname}-%{version} -p1 # Remove bundled egg-info rm -rf %{srcname}.egg-info PKG-INFO @@ -60,6 +62,9 @@ pytest-3 -v %changelog +* Sun Aug 25 2019 Elliott Sales de Andrade - 1.4.6-3 +- Patch tests to work with pyparsing 2.4+ + * Mon Aug 19 2019 Miro HronĨok - 1.4.6-3 - Rebuilt for Python 3.8