#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 <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/066.91496df10705631618b5b85962395a56%40djangoproject.com.