[Django] #31805: MySQL Schema tests fail on Windows

89 views
Skip to first unread message

Django

unread,
Jul 20, 2020, 12:02:57 PM7/20/20
to django-...@googlegroups.com
#31805: MySQL Schema tests fail on Windows
-------------------------------------+-------------------------------------
Reporter: Ahmad A. | Owner: nobody
Hussein |
Type: Bug | Status: new
Component: Database | Version: master
layer (models, ORM) | Keywords: mysql, schema,
Severity: Normal | windows
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
Both tests fail with the same error message:
{{{
ERROR: test_alter_int_pk_to_bigautofield_pk (schema.tests.SchemaTests)
ERROR: test_alter_int_pk_to_int_unique (schema.tests.SchemaTests)
django.db.utils.OperationalError: (1050, "Table 'integerpk' already
exists")
}}}

Tested on Windows with python3.8 and MySQL8.0

--
Ticket URL: <https://code.djangoproject.com/ticket/31805>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jul 20, 2020, 2:48:03 PM7/20/20
to django-...@googlegroups.com
#31805: MySQL Schema tests fail on Windows
-------------------------------------+-------------------------------------
Reporter: Ahmad A. Hussein | Owner: nobody
Type: Bug | Status: new
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: mysql, schema, | Triage Stage:
windows | Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by felixxm):

It's probably not related with running tests on Windows. Can you check a
value of the `lower_case_table_names` parameter? and share a stacktrace.

--
Ticket URL: <https://code.djangoproject.com/ticket/31805#comment:1>

Django

unread,
Jul 20, 2020, 3:24:21 PM7/20/20
to django-...@googlegroups.com
#31805: MySQL Schema tests fail on Windows
-------------------------------------+-------------------------------------
Reporter: Ahmad A. Hussein | Owner: nobody
Type: Bug | Status: closed

Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution: needsinfo

Keywords: mysql, schema, | Triage Stage:
windows | Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by felixxm):

* status: new => closed
* resolution: => needsinfo


--
Ticket URL: <https://code.djangoproject.com/ticket/31805#comment:2>

Django

unread,
Jul 21, 2020, 5:39:44 AM7/21/20
to django-...@googlegroups.com
#31805: MySQL Schema tests fail on Windows
-------------------------------------+-------------------------------------
Reporter: Ahmad A. Hussein | Owner: nobody
Type: Bug | Status: closed
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution: needsinfo
Keywords: mysql, schema, | Triage Stage:
windows | Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Ahmad A. Hussein):

{{{
ERROR: test_alter_int_pk_to_bigautofield_pk (schema.tests.SchemaTests)
Should be able to rename an IntegerField(primary_key=True) to
----------------------------------------------------------------------
Traceback (most recent call last):
File
"c:\users\ahmad\desktop\projects\djangogsoc\django\db\backends\utils.py",
line 82, in _execute
return self.cursor.execute(sql)
File
"c:\users\ahmad\desktop\projects\djangogsoc\django\db\backends\mysql\base.py",
line 73, in execute
return self.cursor.execute(query, args)
File "C:\Users\ahmad\Envs\parallelpr\lib\site-
packages\MySQLdb\cursors.py", line 209, in execute
res = self._query(query)
File "C:\Users\ahmad\Envs\parallelpr\lib\site-
packages\MySQLdb\cursors.py", line 315, in _query
db.query(q)
File "C:\Users\ahmad\Envs\parallelpr\lib\site-
packages\MySQLdb\connections.py", line 239, in query
_mysql.connection.query(self, query)
MySQLdb._exceptions.OperationalError: (1050, "Table 'integerpk' already
exists")

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "C:\Users\ahmad\Desktop\Projects\DjangoGSOC\tests\schema\tests.py",
line 1345, in test_alter_int_pk_to_bigautofield_pk
editor.create_model(IntegerPK)
File
"c:\users\ahmad\desktop\projects\djangogsoc\django\db\backends\base\schema.py",
line 324, in create_model
self.execute(sql, params or None)
File
"c:\users\ahmad\desktop\projects\djangogsoc\django\db\backends\base\schema.py",
line 142, in execute
cursor.execute(sql, params)
File
"c:\users\ahmad\desktop\projects\djangogsoc\django\db\backends\utils.py",
line 98, in execute
return super().execute(sql, params)
File
"c:\users\ahmad\desktop\projects\djangogsoc\django\db\backends\utils.py",
line 66, in execute
return self._execute_with_wrappers(sql, params, many=False,
executor=self._execute)
File
"c:\users\ahmad\desktop\projects\djangogsoc\django\db\backends\utils.py",
line 75, in _execute_with_wrappers
return executor(sql, params, many, context)
File
"c:\users\ahmad\desktop\projects\djangogsoc\django\db\backends\utils.py",
line 84, in _execute
return self.cursor.execute(sql, params)
File "c:\users\ahmad\desktop\projects\djangogsoc\django\db\utils.py",
line 90, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File
"c:\users\ahmad\desktop\projects\djangogsoc\django\db\backends\utils.py",
line 82, in _execute
return self.cursor.execute(sql)
File
"c:\users\ahmad\desktop\projects\djangogsoc\django\db\backends\mysql\base.py",
line 73, in execute
return self.cursor.execute(query, args)
File "C:\Users\ahmad\Envs\parallelpr\lib\site-
packages\MySQLdb\cursors.py", line 209, in execute
res = self._query(query)
File "C:\Users\ahmad\Envs\parallelpr\lib\site-
packages\MySQLdb\cursors.py", line 315, in _query
db.query(q)
File "C:\Users\ahmad\Envs\parallelpr\lib\site-
packages\MySQLdb\connections.py", line 239, in query
_mysql.connection.query(self, query)


django.db.utils.OperationalError: (1050, "Table 'integerpk' already
exists")

----------------------------------------------------------------------
CREATE TABLE `INTEGERPK` (`i` integer NOT NULL PRIMARY KEY, `j` integer
NOT NULL UNIQUE); (params None)
(0.000) SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; args=None
(0.094) None; args=None
(0.000) SET foreign_key_checks=0; args=None
(0.016) SHOW FULL TABLES; args=None
(0.000) SET foreign_key_checks=1; args=None

======================================================================
ERROR: test_alter_int_pk_to_int_unique (schema.tests.SchemaTests)
Should be able to rename an IntegerField(primary_key=True) to
----------------------------------------------------------------------
Traceback (most recent call last):
File
"c:\users\ahmad\desktop\projects\djangogsoc\django\db\backends\utils.py",
line 82, in _execute
return self.cursor.execute(sql)
File
"c:\users\ahmad\desktop\projects\djangogsoc\django\db\backends\mysql\base.py",
line 73, in execute
return self.cursor.execute(query, args)
File "C:\Users\ahmad\Envs\parallelpr\lib\site-
packages\MySQLdb\cursors.py", line 209, in execute
res = self._query(query)
File "C:\Users\ahmad\Envs\parallelpr\lib\site-
packages\MySQLdb\cursors.py", line 315, in _query
db.query(q)
File "C:\Users\ahmad\Envs\parallelpr\lib\site-
packages\MySQLdb\connections.py", line 239, in query
_mysql.connection.query(self, query)
MySQLdb._exceptions.OperationalError: (1050, "Table 'integerpk' already
exists")

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "C:\Users\ahmad\Desktop\Projects\DjangoGSOC\tests\schema\tests.py",
line 1383, in test_alter_int_pk_to_int_unique
editor.create_model(IntegerPK)
File
"c:\users\ahmad\desktop\projects\djangogsoc\django\db\backends\base\schema.py",
line 324, in create_model
self.execute(sql, params or None)
File
"c:\users\ahmad\desktop\projects\djangogsoc\django\db\backends\base\schema.py",
line 142, in execute
cursor.execute(sql, params)
File
"c:\users\ahmad\desktop\projects\djangogsoc\django\db\backends\utils.py",
line 98, in execute
return super().execute(sql, params)
File
"c:\users\ahmad\desktop\projects\djangogsoc\django\db\backends\utils.py",
line 66, in execute
return self._execute_with_wrappers(sql, params, many=False,
executor=self._execute)
File
"c:\users\ahmad\desktop\projects\djangogsoc\django\db\backends\utils.py",
line 75, in _execute_with_wrappers
return executor(sql, params, many, context)
File
"c:\users\ahmad\desktop\projects\djangogsoc\django\db\backends\utils.py",
line 84, in _execute
return self.cursor.execute(sql, params)
File "c:\users\ahmad\desktop\projects\djangogsoc\django\db\utils.py",
line 90, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File
"c:\users\ahmad\desktop\projects\djangogsoc\django\db\backends\utils.py",
line 82, in _execute
return self.cursor.execute(sql)
File
"c:\users\ahmad\desktop\projects\djangogsoc\django\db\backends\mysql\base.py",
line 73, in execute
return self.cursor.execute(query, args)
File "C:\Users\ahmad\Envs\parallelpr\lib\site-
packages\MySQLdb\cursors.py", line 209, in execute
res = self._query(query)
File "C:\Users\ahmad\Envs\parallelpr\lib\site-
packages\MySQLdb\cursors.py", line 315, in _query
db.query(q)
File "C:\Users\ahmad\Envs\parallelpr\lib\site-
packages\MySQLdb\connections.py", line 239, in query
_mysql.connection.query(self, query)


django.db.utils.OperationalError: (1050, "Table 'integerpk' already
exists")

----------------------------------------------------------------------
CREATE TABLE `INTEGERPK` (`i` integer NOT NULL PRIMARY KEY, `j` integer
NOT NULL UNIQUE); (params None)
(0.000) SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; args=None
(0.000) None; args=None
(0.000) SET foreign_key_checks=0; args=None
(0.000) SHOW FULL TABLES; args=None
(0.000) SET foreign_key_checks=1; args=None

----------------------------------------------------------------------
Ran 132 tests in 1083.874s

FAILED (errors=2, skipped=18)
Destroying test database for alias 'default'...
}}}

Value for ```lower_case_table_names``` is 1 (default on Windows)

--
Ticket URL: <https://code.djangoproject.com/ticket/31805#comment:3>

Django

unread,
Jul 21, 2020, 6:51:57 AM7/21/20
to django-...@googlegroups.com
#31805: MySQL Schema tests fail on Windows
-------------------------------------+-------------------------------------
Reporter: Ahmad A. Hussein | Owner: nobody
Type: Bug | Status: closed
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution: needsinfo
Keywords: mysql, schema, | Triage Stage:
windows | Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by felixxm):

Do you run tests on the current master, I'm confused because we have 131
tests in `SchemaTests` and 19 tests are skipped on MySQL 8+. So it looks
that you have an extra tests (132 in logs) maybe it causes an isolation
issue. Also can you reproduce this issue when running these two tests in
isolation?

--
Ticket URL: <https://code.djangoproject.com/ticket/31805#comment:4>

Django

unread,
Jul 21, 2020, 8:31:38 AM7/21/20
to django-...@googlegroups.com
#31805: MySQL Schema tests fail on Windows
-------------------------------------+-------------------------------------
Reporter: Ahmad A. Hussein | Owner: nobody
Type: Bug | Status: closed
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution: needsinfo
Keywords: mysql, schema, | Triage Stage:
windows | Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Ahmad A. Hussein):

Yes, I'm running on the latest master. The reason for the extra test is
because I'm running tests on the entire schema app, not just SchemaTests.
The extra test is from SchemaLoggerTests.

Running the tests on just SchemaTests gives the same errors.

Running the tests in complete isolation though gives a successful test
run.

--
Ticket URL: <https://code.djangoproject.com/ticket/31805#comment:5>

Django

unread,
Jul 21, 2020, 11:02:34 AM7/21/20
to django-...@googlegroups.com
#31805: MySQL Schema tests fail on Windows
-------------------------------------+-------------------------------------
Reporter: Ahmad A. Hussein | Owner: nobody
Type: Bug | Status: closed
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution: needsinfo
Keywords: mysql, schema, | Triage Stage:
windows | Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by felixxm):

Can you also check a storage engine and `sql_mode`? Sorry for so many
questions.

--
Ticket URL: <https://code.djangoproject.com/ticket/31805#comment:6>

Django

unread,
Jul 21, 2020, 11:52:58 AM7/21/20
to django-...@googlegroups.com
#31805: MySQL Schema tests fail on Windows
-------------------------------------+-------------------------------------
Reporter: Ahmad A. Hussein | Owner: nobody
Type: Bug | Status: closed
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution: needsinfo
Keywords: mysql, schema, | Triage Stage:
windows | Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Ahmad A. Hussein):

Feel free to ask! I'm sorry I'm not much help debugging this.

Storage engine is InnoDB

sqlmode is ```sql-mode="STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION"``
I've ran into two new errors as well. I'm going to try to debug them and
I'll update with info once I do.

{{{
======================================================================
ERROR: aggregation.tests (unittest.loader._FailedTest)
----------------------------------------------------------------------
ImportError: Failed to import test module: aggregation.tests


Traceback (most recent call last):
File

"c:\users\ahmad\desktop\projects\djangomain\django\db\backends\base\base.py",
line 219, in ensure_connection
self.connect()
File
"c:\users\ahmad\desktop\projects\djangomain\django\utils\asyncio.py", line
26, in inner
return func(*args, **kwargs)
File
"c:\users\ahmad\desktop\projects\djangomain\django\db\backends\base\base.py",
line 200, in connect
self.connection = self.get_new_connection(conn_params)
File
"c:\users\ahmad\desktop\projects\djangomain\django\utils\asyncio.py", line
26, in inner
return func(*args, **kwargs)
File
"c:\users\ahmad\desktop\projects\djangomain\django\db\backends\mysql\base.py",
line 234, in get_new_connection
return Database.connect(**conn_params)
File "C:\Users\ahmad\Envs\djangodev\lib\site-
packages\MySQLdb\__init__.py", line 130, in Connect
return Connection(*args, **kwargs)
File "C:\Users\ahmad\Envs\djangodev\lib\site-
packages\MySQLdb\connections.py", line 185, in __init__
super().__init__(*args, **kwargs2)
MySQLdb._exceptions.OperationalError: (1049, "Unknown database 'main'")

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File

"c:\users\ahmad\appdata\local\programs\python\python38\lib\unittest\loader.py",
line 436, in _find_test_path
module = self._get_module_from_name(name)
File
"c:\users\ahmad\appdata\local\programs\python\python38\lib\unittest\loader.py",
line 377, in _get_module_from_name
__import__(name)
File
"C:\Users\ahmad\Desktop\Projects\DjangoMain\tests\aggregation\tests.py",
line 21, in <module>
class AggregateTestCase(TestCase):
File
"C:\Users\ahmad\Desktop\Projects\DjangoMain\tests\aggregation\tests.py",
line 1208, in AggregateTestCase
connection.vendor == 'mysql' and 'ONLY_FULL_GROUP_BY' in
connection.sql_mode,
File "c:\users\ahmad\desktop\projects\djangomain\django\db\__init__.py",
line 28, in __getattr__
return getattr(connections[DEFAULT_DB_ALIAS], item)
File
"c:\users\ahmad\desktop\projects\djangomain\django\utils\functional.py",
line 48, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File
"c:\users\ahmad\desktop\projects\djangomain\django\db\backends\mysql\base.py",
line 398, in sql_mode
sql_mode = self.mysql_server_data['sql_mode']
File
"c:\users\ahmad\desktop\projects\djangomain\django\utils\functional.py",
line 48, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File
"c:\users\ahmad\desktop\projects\djangomain\django\db\backends\mysql\base.py",
line 359, in mysql_server_data
with self.temporary_connection() as cursor:
File
"c:\users\ahmad\appdata\local\programs\python\python38\lib\contextlib.py",
line 113, in __enter__
return next(self.gen)
File
"c:\users\ahmad\desktop\projects\djangomain\django\db\backends\base\base.py",
line 603, in temporary_connection
with self.cursor() as cursor:
File
"c:\users\ahmad\desktop\projects\djangomain\django\utils\asyncio.py", line
26, in inner
return func(*args, **kwargs)
File
"c:\users\ahmad\desktop\projects\djangomain\django\db\backends\base\base.py",
line 259, in cursor
return self._cursor()
File
"c:\users\ahmad\desktop\projects\djangomain\django\db\backends\base\base.py",
line 235, in _cursor
self.ensure_connection()
File
"c:\users\ahmad\desktop\projects\djangomain\django\utils\asyncio.py", line
26, in inner
return func(*args, **kwargs)
File
"c:\users\ahmad\desktop\projects\djangomain\django\db\backends\base\base.py",
line 219, in ensure_connection
self.connect()
File "c:\users\ahmad\desktop\projects\djangomain\django\db\utils.py",


line 90, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File

"c:\users\ahmad\desktop\projects\djangomain\django\db\backends\base\base.py",
line 219, in ensure_connection
self.connect()
File
"c:\users\ahmad\desktop\projects\djangomain\django\utils\asyncio.py", line
26, in inner
return func(*args, **kwargs)
File
"c:\users\ahmad\desktop\projects\djangomain\django\db\backends\base\base.py",
line 200, in connect
self.connection = self.get_new_connection(conn_params)
File
"c:\users\ahmad\desktop\projects\djangomain\django\utils\asyncio.py", line
26, in inner
return func(*args, **kwargs)
File
"c:\users\ahmad\desktop\projects\djangomain\django\db\backends\mysql\base.py",
line 234, in get_new_connection
return Database.connect(**conn_params)
File "C:\Users\ahmad\Envs\djangodev\lib\site-
packages\MySQLdb\__init__.py", line 130, in Connect
return Connection(*args, **kwargs)
File "C:\Users\ahmad\Envs\djangodev\lib\site-
packages\MySQLdb\connections.py", line 185, in __init__
super().__init__(*args, **kwargs2)
django.db.utils.OperationalError: (1049, "Unknown database 'main'")


----------------------------------------------------------------------
Ran 15 tests in 2.695s

FAILED (errors=1)


Destroying test database for alias 'default'...

(djangodev) C:\Users\ahmad\Desktop\Projects\DjangoMain\tests>runtests.py
--parallel=1 --settings=test_mysql annotations
Testing against Django installed in
'c:\users\ahmad\desktop\projects\djangomain\django'
System check identified no issues (0 silenced).
E
======================================================================
ERROR: annotations.tests (unittest.loader._FailedTest)
----------------------------------------------------------------------
ImportError: Failed to import test module: annotations.tests


Traceback (most recent call last):
File

"c:\users\ahmad\desktop\projects\djangomain\django\db\backends\base\base.py",
line 219, in ensure_connection
self.connect()
File
"c:\users\ahmad\desktop\projects\djangomain\django\utils\asyncio.py", line
26, in inner
return func(*args, **kwargs)
File
"c:\users\ahmad\desktop\projects\djangomain\django\db\backends\base\base.py",
line 200, in connect
self.connection = self.get_new_connection(conn_params)
File
"c:\users\ahmad\desktop\projects\djangomain\django\utils\asyncio.py", line
26, in inner
return func(*args, **kwargs)
File
"c:\users\ahmad\desktop\projects\djangomain\django\db\backends\mysql\base.py",
line 234, in get_new_connection
return Database.connect(**conn_params)
File "C:\Users\ahmad\Envs\djangodev\lib\site-
packages\MySQLdb\__init__.py", line 130, in Connect
return Connection(*args, **kwargs)
File "C:\Users\ahmad\Envs\djangodev\lib\site-
packages\MySQLdb\connections.py", line 185, in __init__
super().__init__(*args, **kwargs2)
MySQLdb._exceptions.OperationalError: (1049, "Unknown database 'main'")

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File

"c:\users\ahmad\appdata\local\programs\python\python38\lib\unittest\loader.py",
line 436, in _find_test_path
module = self._get_module_from_name(name)
File
"c:\users\ahmad\appdata\local\programs\python\python38\lib\unittest\loader.py",
line 377, in _get_module_from_name
__import__(name)
File
"C:\Users\ahmad\Desktop\Projects\DjangoMain\tests\annotations\tests.py",
line 33, in <module>
class NonAggregateAnnotationTestCase(TestCase):
File
"C:\Users\ahmad\Desktop\Projects\DjangoMain\tests\annotations\tests.py",
line 650, in NonAggregateAnnotationTestCase
connection.vendor == 'mysql' and 'ONLY_FULL_GROUP_BY' in
connection.sql_mode,
File "c:\users\ahmad\desktop\projects\djangomain\django\db\__init__.py",
line 28, in __getattr__
return getattr(connections[DEFAULT_DB_ALIAS], item)
File
"c:\users\ahmad\desktop\projects\djangomain\django\utils\functional.py",
line 48, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File
"c:\users\ahmad\desktop\projects\djangomain\django\db\backends\mysql\base.py",
line 398, in sql_mode
sql_mode = self.mysql_server_data['sql_mode']
File
"c:\users\ahmad\desktop\projects\djangomain\django\utils\functional.py",
line 48, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File
"c:\users\ahmad\desktop\projects\djangomain\django\db\backends\mysql\base.py",
line 359, in mysql_server_data
with self.temporary_connection() as cursor:
File
"c:\users\ahmad\appdata\local\programs\python\python38\lib\contextlib.py",
line 113, in __enter__
return next(self.gen)
File
"c:\users\ahmad\desktop\projects\djangomain\django\db\backends\base\base.py",
line 603, in temporary_connection
with self.cursor() as cursor:
File
"c:\users\ahmad\desktop\projects\djangomain\django\utils\asyncio.py", line
26, in inner
return func(*args, **kwargs)
File
"c:\users\ahmad\desktop\projects\djangomain\django\db\backends\base\base.py",
line 259, in cursor
return self._cursor()
File
"c:\users\ahmad\desktop\projects\djangomain\django\db\backends\base\base.py",
line 235, in _cursor
self.ensure_connection()
File
"c:\users\ahmad\desktop\projects\djangomain\django\utils\asyncio.py", line
26, in inner
return func(*args, **kwargs)
File
"c:\users\ahmad\desktop\projects\djangomain\django\db\backends\base\base.py",
line 219, in ensure_connection
self.connect()
File "c:\users\ahmad\desktop\projects\djangomain\django\db\utils.py",


line 90, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File

"c:\users\ahmad\desktop\projects\djangomain\django\db\backends\base\base.py",
line 219, in ensure_connection
self.connect()
File
"c:\users\ahmad\desktop\projects\djangomain\django\utils\asyncio.py", line
26, in inner
return func(*args, **kwargs)
File
"c:\users\ahmad\desktop\projects\djangomain\django\db\backends\base\base.py",
line 200, in connect
self.connection = self.get_new_connection(conn_params)
File
"c:\users\ahmad\desktop\projects\djangomain\django\utils\asyncio.py", line
26, in inner
return func(*args, **kwargs)
File
"c:\users\ahmad\desktop\projects\djangomain\django\db\backends\mysql\base.py",
line 234, in get_new_connection
return Database.connect(**conn_params)
File "C:\Users\ahmad\Envs\djangodev\lib\site-
packages\MySQLdb\__init__.py", line 130, in Connect
return Connection(*args, **kwargs)
File "C:\Users\ahmad\Envs\djangodev\lib\site-
packages\MySQLdb\connections.py", line 185, in __init__
super().__init__(*args, **kwargs2)
django.db.utils.OperationalError: (1049, "Unknown database 'main'")
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/31805#comment:7>

Django

unread,
Jul 22, 2020, 6:01:10 AM7/22/20
to django-...@googlegroups.com
#31805: MySQL Schema tests fail when table names are case-insensitive.

-------------------------------------+-------------------------------------
Reporter: Ahmad A. Hussein | Owner: nobody
Type: Bug | Status: new
Component: Testing framework | Version: master
Severity: Normal | Resolution:
Keywords: mysql, schema, | Triage Stage: Accepted
windows |
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by felixxm):

* status: closed => new
* component: Database layer (models, ORM) => Testing framework
* has_patch: 0 => 1
* resolution: needsinfo =>
* stage: Unreviewed => Accepted


Comment:

[https://github.com/django/django/pull/13221 PR]

--
Ticket URL: <https://code.djangoproject.com/ticket/31805#comment:8>

Django

unread,
Jul 22, 2020, 6:01:54 AM7/22/20
to django-...@googlegroups.com
#31805: MySQL Schema tests fail when table names are case-insensitive.
-------------------------------------+-------------------------------------
Reporter: Ahmad A. Hussein | Owner: felixxm
Type: Bug | Status: assigned

Component: Testing framework | Version: master
Severity: Normal | Resolution:
Keywords: mysql, schema, | Triage Stage: Accepted
windows |
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by felixxm):

* owner: nobody => felixxm
* status: new => assigned


Comment:

Thanks Carlton for confirmation!

--
Ticket URL: <https://code.djangoproject.com/ticket/31805#comment:9>

Django

unread,
Jul 22, 2020, 6:02:22 AM7/22/20
to django-...@googlegroups.com
#31805: MySQL Schema tests fail when table names are case-insensitive.
-------------------------------------+-------------------------------------
Reporter: Ahmad A. Hussein | Owner: felixxm
Type: Bug | Status: assigned
Component: Testing framework | Version: master
Severity: Normal | Resolution:
Keywords: mysql, schema, | Triage Stage: Accepted
windows |
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Carlton Gibson):

I see this on Windows 10 with MySQL 8.


{{{
...
MySQLdb._exceptions.OperationalError: (1050, "Table 'integerpk' already
exists")

...
Ran 131 tests in 42.172s

FAILED (errors=2, skipped=18)


Destroying test database for alias 'default'...

(django) PS C:\Users\carlt\src\django\tests> django-admin.exe shell
--settings=test_mysql
Python 3.7.5 (tags/v3.7.5:5c02a39a0b, Oct 15 2019, 00:11:34) [MSC v.1916
64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> from django.db import connection
>>> connection.features.ignores_table_name_case
True
}}}

The adjustment in Mariusz´ PR fixes the failure.

--
Ticket URL: <https://code.djangoproject.com/ticket/31805#comment:10>

Django

unread,
Jul 22, 2020, 6:09:26 AM7/22/20
to django-...@googlegroups.com
#31805: MySQL Schema tests fail when table names are case-insensitive.
-------------------------------------+-------------------------------------
Reporter: Ahmad A. Hussein | Owner: felixxm
Type: Bug | Status: assigned
Component: Testing framework | Version: master
Severity: Normal | Resolution:
Keywords: mysql, schema, | Triage Stage: Ready for
windows | checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Carlton Gibson):

* stage: Accepted => Ready for checkin


--
Ticket URL: <https://code.djangoproject.com/ticket/31805#comment:11>

Django

unread,
Jul 22, 2020, 6:50:30 AM7/22/20
to django-...@googlegroups.com
#31805: MySQL Schema tests fail when table names are case-insensitive.
-------------------------------------+-------------------------------------
Reporter: Ahmad A. Hussein | Owner: felixxm
Type: Bug | Status: closed

Component: Testing framework | Version: master
Severity: Normal | Resolution: fixed

Keywords: mysql, schema, | Triage Stage: Ready for
windows | checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by GitHub <noreply@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"fd53db842c35c994dbd54196dd38a908f3676b1a" fd53db8]:
{{{
#!CommitTicketReference repository=""
revision="fd53db842c35c994dbd54196dd38a908f3676b1a"
Fixed #31805 -- Fixed SchemaTests.tearDown() when table names are case-
insensitive.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/31805#comment:12>

Django

unread,
Jul 22, 2020, 6:51:35 AM7/22/20
to django-...@googlegroups.com
#31805: MySQL Schema tests fail when table names are case-insensitive.
-------------------------------------+-------------------------------------
Reporter: Ahmad A. Hussein | Owner: felixxm
Type: Bug | Status: closed
Component: Testing framework | Version: master
Severity: Normal | Resolution: fixed
Keywords: mysql, schema, | Triage Stage: Ready for
windows | checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Mariusz Felisiak <felisiak.mariusz@…>):

In [changeset:"2ff2084cfdac5c49261a091f5094feed96d0de4c" 2ff2084c]:
{{{
#!CommitTicketReference repository=""
revision="2ff2084cfdac5c49261a091f5094feed96d0de4c"
[3.1.x] Fixed #31805 -- Fixed SchemaTests.tearDown() when table names are
case-insensitive.

Backport of fd53db842c35c994dbd54196dd38a908f3676b1a from master
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/31805#comment:13>

Django

unread,
Jul 22, 2020, 6:52:17 AM7/22/20
to django-...@googlegroups.com
#31805: MySQL Schema tests fail when table names are case-insensitive.
-------------------------------------+-------------------------------------
Reporter: Ahmad A. Hussein | Owner: felixxm
Type: Bug | Status: closed
Component: Testing framework | Version: master
Severity: Normal | Resolution: fixed
Keywords: mysql, schema, | Triage Stage: Ready for
windows | checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Mariusz Felisiak <felisiak.mariusz@…>):

In [changeset:"dcb27ead84a91e8d38a183cfc2f7640141eb40f8" dcb27ead]:
{{{
#!CommitTicketReference repository=""
revision="dcb27ead84a91e8d38a183cfc2f7640141eb40f8"
[3.0.x] Fixed #31805 -- Fixed SchemaTests.tearDown() when table names are
case-insensitive.

Backport of fd53db842c35c994dbd54196dd38a908f3676b1a from master
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/31805#comment:14>

Django

unread,
Jul 22, 2020, 6:55:25 AM7/22/20
to django-...@googlegroups.com
#31805: MySQL Schema tests fail when table names are case-insensitive.
-------------------------------------+-------------------------------------
Reporter: Ahmad A. Hussein | Owner: felixxm
Type: Bug | Status: closed
Component: Testing framework | Version: master
Severity: Normal | Resolution: fixed
Keywords: mysql, schema, | Triage Stage: Ready for
windows | checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Mariusz Felisiak <felisiak.mariusz@…>):

In [changeset:"eb815938750bed7e4f8f9ec1974d60e4994a9421" eb815938]:
{{{
#!CommitTicketReference repository=""
revision="eb815938750bed7e4f8f9ec1974d60e4994a9421"
[2.2.x] Fixed #31805 -- Fixed SchemaTests.tearDown() when table names are
case-insensitive.

Backport of fd53db842c35c994dbd54196dd38a908f3676b1a from master
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/31805#comment:15>

Reply all
Reply to author
Forward
0 new messages