Skip to content

Commit

Permalink
Rename utility function to avoid pytest confusion: test_exception_msg…
Browse files Browse the repository at this point in the history
… -> check_exception_msg
  • Loading branch information
kozlovsky committed Sep 25, 2023
1 parent 959ac5d commit fd197b9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pony/orm/tests/testutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from pony.orm.core import Database
from pony.utils import import_module

def test_exception_msg(test_case, exc_msg, test_msg=None):
def check_exception_msg(test_case, exc_msg, test_msg=None):
if test_msg is None: return
error_template = "incorrect exception message. expected '%s', got '%s'"
error_msg = error_template % (test_msg, exc_msg)
Expand All @@ -30,7 +30,7 @@ def wrapper(test_case, *args, **kwargs):
test_case.fail("Expected exception %s wasn't raised" % exc_class.__name__)
except exc_class as e:
if not e.args: test_case.assertEqual(test_msg, None)
else: test_exception_msg(test_case, str(e), test_msg)
else: check_exception_msg(test_case, str(e), test_msg)
wrapper.__name__ = func.__name__
return wrapper
return decorator
Expand All @@ -41,7 +41,7 @@ def raises_if(test_case, cond, exc_class, test_msg=None):
yield
except exc_class as e:
test_case.assertTrue(cond)
test_exception_msg(test_case, str(e), test_msg)
check_exception_msg(test_case, str(e), test_msg)
else:
test_case.assertFalse(cond, "Expected exception %s wasn't raised" % exc_class.__name__)

Expand Down

0 comments on commit fd197b9

Please sign in to comment.