#28478: Make DiscoverRunner skip creating a test database if not needed
--------------------------------------+------------------------------------
Reporter: Tim Graham | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Testing framework | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by Tim Graham):
* status: closed => new
* resolution: fixed =>
Comment:
A failure appeared after 41e73de39df31c4b13d65462bfeedde6924226d8:
{{{
./tests/runtests.py --settings=test_postgres postgres_tests
Testing against Django installed in '/home/tim/code/django/django' with up
to 3 processes
PostgreSQL 90515
Creating test database for alias 'default'…
Cloning test database for alias 'default'…
Cloning test database for alias 'default'…
Cloning test database for alias 'default'…
System check identified no issues (0 silenced).
...
======================================================================
ERROR: test_datetime_prepare_value
(postgres_tests.test_ranges.TestFormField)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/opt/python3.7.0/lib/python3.7/unittest/case.py", line 59, in
testPartExecutor
yield
File "/opt/python3.7.0/lib/python3.7/unittest/case.py", line 615, in run
testMethod()
File "/home/tim/code/django/django/test/utils.py", line 370, in inner
with self as context:
File "/home/tim/code/django/django/test/utils.py", line 338, in
__enter__
return self.enable()
File "/home/tim/code/django/django/test/utils.py", line 419, in enable
self.disable()
File "/home/tim/code/django/django/test/utils.py", line 437, in disable
raise exc
File "/home/tim/code/django/django/test/utils.py", line 415, in enable
setting=key, value=new_value, enter=True,
File "/home/tim/code/django/django/dispatch/dispatcher.py", line 175, in
send
for receiver in self._live_receivers(sender)
File "/home/tim/code/django/django/dispatch/dispatcher.py", line 175, in
<listcomp>
for receiver in self._live_receivers(sender)
File "/home/tim/code/django/django/test/signals.py", line 74, in
update_connections_time_zone
conn.ensure_timezone()
File "/home/tim/code/django/django/db/backends/postgresql/base.py", line
198, in ensure_timezone
self.ensure_connection()
File "/home/tim/code/django/django/db/backends/base/base.py", line 216,
in ensure_connection
self.connect()
File "/home/tim/code/django/django/db/utils.py", line 89, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/home/tim/code/django/django/db/backends/base/base.py", line 216,
in ensure_connection
self.connect()
File "/home/tim/code/django/django/db/backends/base/base.py", line 194,
in connect
self.connection = self.get_new_connection(conn_params)
File "/home/tim/code/django/django/db/backends/postgresql/base.py", line
178, in get_new_connection
connection = Database.connect(**conn_params)
File "/home/tim/.virtualenvs/django37/lib/python3.7/site-
packages/psycopg2/__init__.py", line 130, in connect
conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
django.db.utils.OperationalError: FATAL: database "djangotests2_2" does
not exist
}}}
Add `--parallel=1` and there's no problem.
--
Ticket URL: <https://code.djangoproject.com/ticket/28478#comment:13>
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 post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/067.6d7d9e7c84c8531d29123492e820df0d%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.