Closed
Description
(Pull the latest changes from the spanner-2.2.x branch of the Django fork as I've edited the SQL in this test to work with Spanner.)
GoogleAPICallError
currently happens but DatabaseError
is expected:
======================================================================
ERROR: test_duplicate_table_error (backends.tests.BackendTestCase)
Creating an existing table returns a DatabaseError
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/tim/code/django/django/test/testcases.py", line 274, in __call__
self._post_teardown()
File "/home/tim/code/django/django/test/testcases.py", line 1009, in _post_teardown
self._fixture_teardown()
File "/home/tim/code/django/django/test/testcases.py", line 1044, in _fixture_teardown
inhibit_post_migrate=inhibit_post_migrate)
File "/home/tim/code/django/django/core/management/__init__.py", line 148, in call_command
return command.execute(*args, **defaults)
File "/home/tim/code/django/django/core/management/base.py", line 364, in execute
output = self.handle(*args, **options)
File "/home/tim/code/django/django/core/management/commands/flush.py", line 49, in handle
allow_cascade=allow_cascade)
File "/home/tim/code/django/django/core/management/sql.py", line 13, in sql_flush
tables = connection.introspection.django_table_names(only_existing=True, include_views=False)
File "/home/tim/code/django/django/db/backends/base/introspection.py", line 78, in django_table_names
existing_tables = set(self.table_names(include_views=include_views))
File "/home/tim/code/django/django/db/backends/base/introspection.py", line 47, in table_names
return get_names(cursor)
File "/home/tim/code/django/django/db/backends/base/introspection.py", line 43, in get_names
return sorted(ti.name for ti in self.get_table_list(cursor)
File "/home/tim/code/spanner-django/spanner/django/introspection.py", line 27, in get_table_list
return [TableInfo(row[0], 't') for row in cursor.list_tables()]
File "/home/tim/code/spanner-django/spanner/dbapi/autocommit_on_cursor.py", line 272, in list_tables
return self.__db_handle.list_tables()
File "/home/tim/code/spanner-django/spanner/dbapi/autocommit_on_connection.py", line 99, in list_tables
""")
File "/home/tim/code/spanner-django/spanner/dbapi/autocommit_on_connection.py", line 104, in run_sql_in_snapshot
self.run_prior_DDL_statements()
File "/home/tim/code/spanner-django/spanner/dbapi/autocommit_on_connection.py", line 89, in run_prior_DDL_statements
return self.__handle_update_ddl(ddl_statements)
File "/home/tim/code/spanner-django/spanner/dbapi/autocommit_on_connection.py", line 64, in __handle_update_ddl
return self.__dbhandle.update_ddl(ddl_statements).result()
File "/home/tim/.virtualenvs/django37/lib/python3.7/site-packages/google/api_core/future/polling.py", line 127, in result
raise self._exception
google.api_core.exceptions.GoogleAPICallError: None Duplicate name in schema: backends_article.
======================================================================
FAIL: test_duplicate_table_error (backends.tests.BackendTestCase)
Creating an existing table returns a DatabaseError
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/tim/code/django/tests/backends/tests.py", line 350, in test_duplicate_table_error
cursor.execute(query)
AssertionError: DatabaseError not raised