You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by vi...@apache.org on 2021/01/15 14:46:56 UTC

[superset] branch master updated: add test_extract_error_message (#12548)

This is an automated email from the ASF dual-hosted git repository.

villebro pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/superset.git


The following commit(s) were added to refs/heads/master by this push:
     new 5fbfb82  add test_extract_error_message (#12548)
5fbfb82 is described below

commit 5fbfb822663989a477ec64c2474ac07660a8e36f
Author: Karol Kostrzewa <ka...@gmail.com>
AuthorDate: Fri Jan 15 15:46:27 2021 +0100

    add test_extract_error_message (#12548)
---
 tests/db_engine_specs/mysql_tests.py | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/tests/db_engine_specs/mysql_tests.py b/tests/db_engine_specs/mysql_tests.py
index b3ebdfc..5a344d9 100644
--- a/tests/db_engine_specs/mysql_tests.py
+++ b/tests/db_engine_specs/mysql_tests.py
@@ -101,3 +101,15 @@ class TestMySQLEngineSpecsDbEngineSpec(TestDbEngineSpec):
             assert MySQLEngineSpec.is_db_column_type_match(
                 type_str, DbColumnType.TEMPORAL
             ) is (col_type == DbColumnType.TEMPORAL)
+
+    def test_extract_error_message(self):
+        from MySQLdb._exceptions import OperationalError
+
+        message = "Unknown table 'BIRTH_NAMES1' in information_schema"
+        exception = OperationalError(message)
+        extracted_message = MySQLEngineSpec._extract_error_message(exception)
+        assert extracted_message == message
+
+        exception = OperationalError(123, message)
+        extracted_message = MySQLEngineSpec._extract_error_message(exception)
+        assert extracted_message == message