#34849: Appending django.contrib.postgres to the INSTALLED_APPS via
@modify_settings crashes.
-------------------------------------+-------------------------------------
     Reporter:  Mariusz Felisiak     |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  Database layer       |                  Version:  5.0
  (models, ORM)                      |
     Severity:  Release blocker      |               Resolution:
     Keywords:                       |             Triage Stage:  Accepted
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by Florian Zimmermann):

 Maybe worth noting: for me this depends on the `--parallel` option with
 `--parallel 1` producing even more errors:

 `--parallel 2` no errors:
 {{{
 > python runtests.py --settings test_postgres --parallel 2 postgres_tests
 Found 590 test(s).
 
..........................................................................................................................x......x............x...............................................................................................................................................................................................................................................................................................................................................................................................................................................................
 ----------------------------------------------------------------------
 Ran 590 tests in 7.974s

 OK (expected failures=3)
 }}}

 `--parallel 4` two errors:
 {{{
 > python runtests.py --settings test_postgres --parallel 4 postgres_tests
 Found 590 test(s).
 
EE........................................................................................................................x......x............x...............................................................................................................................................................................................................................................................................................................................................................................................................................................................
 ======================================================================
 ERROR: test_register_serializer_for_migrations
 (postgres_tests.test_apps.PostgresConfigTests)
 ----------------------------------------------------------------------
 Traceback (most recent call last):
   File "C:\Program Files\Python310\lib\unittest\case.py", line 59, in
 testPartExecutor
     yield
   File "C:\Program Files\Python310\lib\unittest\case.py", line 591, in run
     self._callTestMethod(testMethod)
   File "C:\Program Files\Python310\lib\unittest\case.py", line 549, in
 _callTestMethod
     method()
   File "D:\django\tests\postgres_tests\test_apps.py", line 64, in
 test_register_serializer_for_migrations
     with self.modify_settings(INSTALLED_APPS={"append":
 "django.contrib.postgres"}):
   File "D:\django\django\test\utils.py", line 405, in __enter__
     return self.enable()
   File "D:\django\django\test\utils.py", line 587, in enable
     super().enable()
   File "D:\django\django\test\utils.py", line 474, in enable
     apps.set_installed_apps(self.options["INSTALLED_APPS"])
   File "D:\django\django\apps\registry.py", line 362, in
 set_installed_apps
     self.populate(installed)
   File "D:\django\django\apps\registry.py", line 124, in populate
     app_config.ready()
   File "D:\django\django\contrib\postgres\apps.py", line 71, in ready
     register_type_handlers(conn)
   File "D:\django\django\contrib\postgres\signals.py", line 40, in
 register_type_handlers
     oids, array_oids = get_hstore_oids(connection.alias)
   File "D:\django\django\contrib\postgres\signals.py", line 24, in
 get_hstore_oids
     return get_type_oids(connection_alias, "hstore")
   File "D:\django\django\contrib\postgres\signals.py", line 10, in
 get_type_oids
     cursor.execute(
   File "D:\django\django\db\backends\utils.py", line 77, in execute
     return self._execute_with_wrappers(
   File "D:\django\django\db\backends\utils.py", line 90, in
 _execute_with_wrappers
     return executor(sql, params, many, context)
   File "D:\django\django\db\backends\utils.py", line 94, in _execute
     warnings.warn(self.APPS_NOT_READY_WARNING_MSG,
 category=RuntimeWarning)
 RuntimeWarning: Accessing the database during app initialization is
 discouraged. To fix this warning, avoid executing queries in
 AppConfig.ready() or when your app modules are imported.

 ======================================================================
 ERROR: test_register_type_handlers_connection
 (postgres_tests.test_apps.PostgresConfigTests)
 ----------------------------------------------------------------------
 Traceback (most recent call last):
   File "C:\Program Files\Python310\lib\unittest\case.py", line 59, in
 testPartExecutor
     yield
   File "C:\Program Files\Python310\lib\unittest\case.py", line 591, in run
     self._callTestMethod(testMethod)
   File "C:\Program Files\Python310\lib\unittest\case.py", line 549, in
 _callTestMethod
     method()
   File "D:\django\tests\postgres_tests\test_apps.py", line 36, in
 test_register_type_handlers_connection
     with modify_settings(INSTALLED_APPS={"append":
 "django.contrib.postgres"}):
   File "D:\django\django\test\utils.py", line 405, in __enter__
     return self.enable()
   File "D:\django\django\test\utils.py", line 587, in enable
     super().enable()
   File "D:\django\django\test\utils.py", line 474, in enable
     apps.set_installed_apps(self.options["INSTALLED_APPS"])
   File "D:\django\django\apps\registry.py", line 362, in
 set_installed_apps
     self.populate(installed)
   File "D:\django\django\apps\registry.py", line 124, in populate
     app_config.ready()
   File "D:\django\django\contrib\postgres\apps.py", line 71, in ready
     register_type_handlers(conn)
   File "D:\django\django\contrib\postgres\signals.py", line 40, in
 register_type_handlers
     oids, array_oids = get_hstore_oids(connection.alias)
   File "D:\django\django\contrib\postgres\signals.py", line 24, in
 get_hstore_oids
     return get_type_oids(connection_alias, "hstore")
   File "D:\django\django\contrib\postgres\signals.py", line 10, in
 get_type_oids
     cursor.execute(
   File "D:\django\django\db\backends\utils.py", line 77, in execute
     return self._execute_with_wrappers(
   File "D:\django\django\db\backends\utils.py", line 90, in
 _execute_with_wrappers
     return executor(sql, params, many, context)
   File "D:\django\django\db\backends\utils.py", line 94, in _execute
     warnings.warn(self.APPS_NOT_READY_WARNING_MSG,
 category=RuntimeWarning)
 RuntimeWarning: Accessing the database during app initialization is
 discouraged. To fix this warning, avoid executing queries in
 AppConfig.ready() or when your app modules are imported.

 ----------------------------------------------------------------------
 Ran 590 tests in 4.268s

 FAILED (errors=2, expected failures=3)
 }}}

 `--parallel 1` five errors:
 {{{
 > python runtests.py --settings test_postgres --parallel 1 postgres_tests
 Found 590 test(s).
 
EEEEE...................................x......x............x............................................................................................................................................................................................................................................................................................................................................................................................................................................................................
 ======================================================================
 ERROR: setUpClass (postgres_tests.test_aggregates.TestAggregateDistinct)
 ----------------------------------------------------------------------
 Traceback (most recent call last):
   File "D:\django\django\test\testcases.py", line 1250, in setUpClass
     super().setUpClass()
   File "D:\django\django\test\testcases.py", line 197, in setUpClass
     cls._cls_modified_context.enable()
   File "D:\django\django\test\utils.py", line 587, in enable
     super().enable()
   File "D:\django\django\test\utils.py", line 474, in enable
     apps.set_installed_apps(self.options["INSTALLED_APPS"])
   File "D:\django\django\apps\registry.py", line 362, in
 set_installed_apps
     self.populate(installed)
   File "D:\django\django\apps\registry.py", line 124, in populate
     app_config.ready()
   File "D:\django\django\contrib\postgres\apps.py", line 71, in ready
     register_type_handlers(conn)
   File "D:\django\django\contrib\postgres\signals.py", line 40, in
 register_type_handlers
     oids, array_oids = get_hstore_oids(connection.alias)
   File "D:\django\django\contrib\postgres\signals.py", line 24, in
 get_hstore_oids
     return get_type_oids(connection_alias, "hstore")
   File "D:\django\django\contrib\postgres\signals.py", line 10, in
 get_type_oids
     cursor.execute(
   File "D:\django\django\db\backends\utils.py", line 77, in execute
     return self._execute_with_wrappers(
   File "D:\django\django\db\backends\utils.py", line 90, in
 _execute_with_wrappers
     return executor(sql, params, many, context)
   File "D:\django\django\db\backends\utils.py", line 94, in _execute
     warnings.warn(self.APPS_NOT_READY_WARNING_MSG,
 category=RuntimeWarning)
 RuntimeWarning: Accessing the database during app initialization is
 discouraged. To fix this warning, avoid executing queries in
 AppConfig.ready() or when your app modules are imported.

 ======================================================================
 ERROR: setUpClass (postgres_tests.test_aggregates.TestGeneralAggregate)
 ----------------------------------------------------------------------
 Traceback (most recent call last):
   File "D:\django\django\test\testcases.py", line 1250, in setUpClass
     super().setUpClass()
   File "D:\django\django\test\testcases.py", line 197, in setUpClass
     cls._cls_modified_context.enable()
   File "D:\django\django\test\utils.py", line 587, in enable
     super().enable()
   File "D:\django\django\test\utils.py", line 474, in enable
     apps.set_installed_apps(self.options["INSTALLED_APPS"])
   File "D:\django\django\apps\registry.py", line 362, in
 set_installed_apps
     self.populate(installed)
   File "D:\django\django\apps\registry.py", line 124, in populate
     app_config.ready()
   File "D:\django\django\contrib\postgres\apps.py", line 71, in ready
     register_type_handlers(conn)
   File "D:\django\django\contrib\postgres\signals.py", line 40, in
 register_type_handlers
     oids, array_oids = get_hstore_oids(connection.alias)
   File "D:\django\django\contrib\postgres\signals.py", line 24, in
 get_hstore_oids
     return get_type_oids(connection_alias, "hstore")
   File "D:\django\django\contrib\postgres\signals.py", line 10, in
 get_type_oids
     cursor.execute(
   File "D:\django\django\db\backends\utils.py", line 77, in execute
     return self._execute_with_wrappers(
   File "D:\django\django\db\backends\utils.py", line 90, in
 _execute_with_wrappers
     return executor(sql, params, many, context)
   File "D:\django\django\db\backends\utils.py", line 94, in _execute
     warnings.warn(self.APPS_NOT_READY_WARNING_MSG,
 category=RuntimeWarning)
 RuntimeWarning: Accessing the database during app initialization is
 discouraged. To fix this warning, avoid executing queries in
 AppConfig.ready() or when your app modules are imported.

 ======================================================================
 ERROR: setUpClass (postgres_tests.test_aggregates.TestStatisticsAggregate)
 ----------------------------------------------------------------------
 Traceback (most recent call last):
   File "D:\django\django\test\testcases.py", line 1250, in setUpClass
     super().setUpClass()
   File "D:\django\django\test\testcases.py", line 197, in setUpClass
     cls._cls_modified_context.enable()
   File "D:\django\django\test\utils.py", line 587, in enable
     super().enable()
   File "D:\django\django\test\utils.py", line 474, in enable
     apps.set_installed_apps(self.options["INSTALLED_APPS"])
   File "D:\django\django\apps\registry.py", line 362, in
 set_installed_apps
     self.populate(installed)
   File "D:\django\django\apps\registry.py", line 124, in populate
     app_config.ready()
   File "D:\django\django\contrib\postgres\apps.py", line 71, in ready
     register_type_handlers(conn)
   File "D:\django\django\contrib\postgres\signals.py", line 40, in
 register_type_handlers
     oids, array_oids = get_hstore_oids(connection.alias)
   File "D:\django\django\contrib\postgres\signals.py", line 24, in
 get_hstore_oids
     return get_type_oids(connection_alias, "hstore")
   File "D:\django\django\contrib\postgres\signals.py", line 10, in
 get_type_oids
     cursor.execute(
   File "D:\django\django\db\backends\utils.py", line 77, in execute
     return self._execute_with_wrappers(
   File "D:\django\django\db\backends\utils.py", line 90, in
 _execute_with_wrappers
     return executor(sql, params, many, context)
   File "D:\django\django\db\backends\utils.py", line 94, in _execute
     warnings.warn(self.APPS_NOT_READY_WARNING_MSG,
 category=RuntimeWarning)
 RuntimeWarning: Accessing the database during app initialization is
 discouraged. To fix this warning, avoid executing queries in
 AppConfig.ready() or when your app modules are imported.

 ======================================================================
 ERROR: test_register_serializer_for_migrations
 (postgres_tests.test_apps.PostgresConfigTests)
 ----------------------------------------------------------------------
 Traceback (most recent call last):
   File "D:\django\tests\postgres_tests\test_apps.py", line 64, in
 test_register_serializer_for_migrations
     with self.modify_settings(INSTALLED_APPS={"append":
 "django.contrib.postgres"}):
   File "D:\django\django\test\utils.py", line 405, in __enter__
     return self.enable()
   File "D:\django\django\test\utils.py", line 587, in enable
     super().enable()
   File "D:\django\django\test\utils.py", line 474, in enable
     apps.set_installed_apps(self.options["INSTALLED_APPS"])
   File "D:\django\django\apps\registry.py", line 362, in
 set_installed_apps
     self.populate(installed)
   File "D:\django\django\apps\registry.py", line 124, in populate
     app_config.ready()
   File "D:\django\django\contrib\postgres\apps.py", line 71, in ready
     register_type_handlers(conn)
   File "D:\django\django\contrib\postgres\signals.py", line 40, in
 register_type_handlers
     oids, array_oids = get_hstore_oids(connection.alias)
   File "D:\django\django\contrib\postgres\signals.py", line 24, in
 get_hstore_oids
     return get_type_oids(connection_alias, "hstore")
   File "D:\django\django\contrib\postgres\signals.py", line 10, in
 get_type_oids
     cursor.execute(
   File "D:\django\django\db\backends\utils.py", line 77, in execute
     return self._execute_with_wrappers(
   File "D:\django\django\db\backends\utils.py", line 90, in
 _execute_with_wrappers
     return executor(sql, params, many, context)
   File "D:\django\django\db\backends\utils.py", line 94, in _execute
     warnings.warn(self.APPS_NOT_READY_WARNING_MSG,
 category=RuntimeWarning)
 RuntimeWarning: Accessing the database during app initialization is
 discouraged. To fix this warning, avoid executing queries in
 AppConfig.ready() or when your app modules are imported.

 ======================================================================
 ERROR: test_register_type_handlers_connection
 (postgres_tests.test_apps.PostgresConfigTests)
 ----------------------------------------------------------------------
 Traceback (most recent call last):
   File "D:\django\tests\postgres_tests\test_apps.py", line 36, in
 test_register_type_handlers_connection
     with modify_settings(INSTALLED_APPS={"append":
 "django.contrib.postgres"}):
   File "D:\django\django\test\utils.py", line 405, in __enter__
     return self.enable()
   File "D:\django\django\test\utils.py", line 587, in enable
     super().enable()
   File "D:\django\django\test\utils.py", line 474, in enable
     apps.set_installed_apps(self.options["INSTALLED_APPS"])
   File "D:\django\django\apps\registry.py", line 362, in
 set_installed_apps
     self.populate(installed)
   File "D:\django\django\apps\registry.py", line 124, in populate
     app_config.ready()
   File "D:\django\django\contrib\postgres\apps.py", line 71, in ready
     register_type_handlers(conn)
   File "D:\django\django\contrib\postgres\signals.py", line 40, in
 register_type_handlers
     oids, array_oids = get_hstore_oids(connection.alias)
   File "D:\django\django\contrib\postgres\signals.py", line 24, in
 get_hstore_oids
     return get_type_oids(connection_alias, "hstore")
   File "D:\django\django\contrib\postgres\signals.py", line 10, in
 get_type_oids
     cursor.execute(
   File "D:\django\django\db\backends\utils.py", line 77, in execute
     return self._execute_with_wrappers(
   File "D:\django\django\db\backends\utils.py", line 90, in
 _execute_with_wrappers
     return executor(sql, params, many, context)
   File "D:\django\django\db\backends\utils.py", line 94, in _execute
     warnings.warn(self.APPS_NOT_READY_WARNING_MSG,
 category=RuntimeWarning)
 RuntimeWarning: Accessing the database during app initialization is
 discouraged. To fix this warning, avoid executing queries in
 AppConfig.ready() or when your app modules are imported.

 ----------------------------------------------------------------------
 Ran 518 tests in 14.649s

 FAILED (errors=5, expected failures=3)
 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/34849#comment:4>
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/0107018aaf34c828-04d4eefd-1962-4682-82da-ece7bccbbe55-000000%40eu-central-1.amazonses.com.

Reply via email to