From 67fb3a821542d655c8c6b5a8a6660139094f0b92 Mon Sep 17 00:00:00 2001 From: Toshio Kuratomi Date: Mon, 22 Jul 2019 16:18:59 -0700 Subject: [PATCH] Fix root filter test On python-2.6 the error message is different --- test/units/plugins/filter/test_mathstuff.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/test/units/plugins/filter/test_mathstuff.py b/test/units/plugins/filter/test_mathstuff.py index 36fd768b2c7..8d07599682b 100644 --- a/test/units/plugins/filter/test_mathstuff.py +++ b/test/units/plugins/filter/test_mathstuff.py @@ -97,6 +97,7 @@ class TestLogarithm: class TestPower: def test_power_non_number(self): + # Message changed in python3.6 with pytest.raises(AnsibleFilterError, match='pow\\(\\) can only be used on numbers: (a float is required|must be real number, not str)'): ms.power('a', 10) @@ -112,10 +113,11 @@ class TestPower: class TestInversePower: def test_root_non_number(self): - # Message changed in python3.6 + # Messages differed in python-2.6, python-2.7-3.5, and python-3.6+ with pytest.raises(AnsibleFilterError, match="root\\(\\) can only be used on numbers:" - " (could not convert string to float: a" - "|could not convert string to float: 'a')"): + " (invalid literal for float(): a)" + "|could not convert string to float: a" + "|could not convert string to float: 'a'"): ms.inversepower(10, 'a') with pytest.raises(AnsibleFilterError, match="root\\(\\) can only be used on numbers: (a float is required|must be real number, not str)"):