Changeset: fb33719a7386 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/fb33719a7386
Modified Files:
testing/sqllogictest.py
Branch: default
Log Message:
If expected error message surrounded by slashes, treat it as regexp.
So, use e.g. statement error 22018!/^conversion of string 'a' to type /
diffs (61 lines):
diff --git a/testing/sqllogictest.py b/testing/sqllogictest.py
--- a/testing/sqllogictest.py
+++ b/testing/sqllogictest.py
@@ -287,28 +287,42 @@ class SQLLogic:
# check whether failed as expected
err_code_received, err_msg_received =
utils.parse_mapi_err_msg(msg)
if expected_err_code and expected_err_msg and
err_code_received and err_msg_received:
- if expected_err_msg.endswith('...') and
expected_err_code == err_code_received and
err_msg_received.lower().startswith(expected_err_msg[:expected_err_msg.find('...')].lower()):
- result.append(err_code_received + '!' +
expected_err_msg)
- return result
- result.append(err_code_received + '!' +
err_msg_received)
- if expected_err_code == err_code_received and
expected_err_msg.lower() == err_msg_received.lower():
- return result
+ if expected_err_msg.startswith('/') and
expected_err_msg.endswith('/'):
+ res = re.match(expected_err_msg[1:-1],
err_msg_received)
+ if expected_err_code == err_code_received and res
is not None:
+ result.append(err_code_received + '!' +
expected_err_msg)
+ return result
+ result.append(err_code_received + '!' +
err_msg_received)
+ else:
+ if expected_err_msg.endswith('...') and
expected_err_code == err_code_received and
err_msg_received.lower().startswith(expected_err_msg[:expected_err_msg.find('...')].lower()):
+ result.append(err_code_received + '!' +
expected_err_msg)
+ return result
+ result.append(err_code_received + '!' +
err_msg_received)
+ if expected_err_code == err_code_received and
expected_err_msg.lower() == err_msg_received.lower():
+ return result
else:
if expected_err_code and err_code_received:
result.append(err_code_received + '!')
if expected_err_code == err_code_received:
return result
elif expected_err_msg and err_msg_received:
- if expected_err_msg.endswith('...') and
err_msg_received.lower().startswith(expected_err_msg[:expected_err_msg.find('...')].lower()):
- result.append(expected_err_msg)
- return result
- result.append(err_msg_received)
- if expected_err_msg.lower() ==
err_msg_received.lower():
- return result
+ if expected_err_msg.startswith('/') and
expected_err_msg.endswith('/'):
+ res = re.match(expected_err_msg[1:-1],
err_msg_received)
+ if res is not None:
+ result.append(expected_err_msg)
+ return result
+ result.append(err_msg_received)
+ else:
+ if expected_err_msg.endswith('...') and
err_msg_received.lower().startswith(expected_err_msg[:expected_err_msg.find('...')].lower()):
+ result.append(expected_err_msg)
+ return result
+ result.append(err_msg_received)
+ if expected_err_msg.lower() ==
err_msg_received.lower():
+ return result
msg = "statement was expected to fail with" \
- + (f" error code {expected_err_code}" if
expected_err_code else '') \
- + (f", error message {repr(expected_err_msg)}" if
expected_err_msg else '') \
- + f", received code {err_code_received}, message
{repr(err_msg_received)}"
+ + (f" error code {expected_err_code}," if
expected_err_code else '') \
+ + (f" error message {repr(expected_err_msg)}," if
expected_err_msg else '') \
+ + f" received code {err_code_received}, message
{repr(err_msg_received)}"
self.query_error(err_stmt or statement, str(msg), str(e))
return result
except ConnectionError as e:
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]