self = <django.db.backends.postgresql.base.DatabaseWrapper object at 0x7f869ea1c518>
def ensure_connection(self):
"""Guarantee that a connection to the database is established."""
if self.connection is None:
with self.wrap_database_errors:
> self.connect()
.tox/py3/lib/python3.7/site-packages/django/db/backends/base/base.py:217:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <django.db.backends.postgresql.base.DatabaseWrapper object at 0x7f869ea1c518>
def connect(self):
"""Connect to the database. Assume that the connection is closed."""
# Check for invalid configurations.
self.check_settings()
# In case the previous connection was closed while in an atomic block
self.in_atomic_block = False
self.savepoint_ids = []
self.needs_rollback = False
# Reset parameters defining when to close the connection
max_age = self.settings_dict['CONN_MAX_AGE']
self.close_at = None if max_age is None else time.time() + max_age
self.closed_in_transaction = False
self.errors_occurred = False
# Establish the connection
conn_params = self.get_connection_params()
> self.connection = self.get_new_connection(conn_params)
.tox/py3/lib/python3.7/site-packages/django/db/backends/base/base.py:195:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <django.db.backends.postgresql.base.DatabaseWrapper object at 0x7f869ea1c518>
conn_params = {'database': 'swh-web-test'}
def get_new_connection(self, conn_params):
> connection = Database.connect(**conn_params)
.tox/py3/lib/python3.7/site-packages/django/db/backends/postgresql/base.py:178:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
dsn = 'dbname=swh-web-test', connection_factory = None, cursor_factory = None
kwargs = {'database': 'swh-web-test'}, kwasync = {}
def connect(dsn=None, connection_factory=None, cursor_factory=None, **kwargs):
"""
Create a new database connection.
The connection parameters can be specified as a string:
conn = psycopg2.connect("dbname=test user=postgres password=secret")
or using a set of keyword arguments:
conn = psycopg2.connect(database="test", user="postgres", password="secret")
Or as a mix of both. The basic connection parameters are:
- *dbname*: the database name
- *database*: the database name (only as keyword argument)
- *user*: user name used to authenticate
- *password*: password used to authenticate
- *host*: database host address (defaults to UNIX socket if not provided)
- *port*: connection port number (defaults to 5432 if not provided)
Using the *connection_factory* parameter a different class or connections
factory can be specified. It should be a callable object taking a dsn
argument.
Using the *cursor_factory* parameter, a new default cursor factory will be
used by cursor().
Using *async*=True an asynchronous connection will be created. *async_* is
a valid alias (for Python versions where ``async`` is a keyword).
Any other keyword parameter will be passed to the underlying client
library: the list of supported parameters depends on the library version.
"""
kwasync = {}
if 'async' in kwargs:
kwasync['async'] = kwargs.pop('async')
if 'async_' in kwargs:
kwasync['async_'] = kwargs.pop('async_')
dsn = _ext.make_dsn(dsn, **kwargs)
> conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
E psycopg2.OperationalError: could not connect to server: No such file or directory
E Is the server running locally and accepting
E connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
.tox/py3/lib/python3.7/site-packages/psycopg2/__init__.py:122: OperationalError
The above exception was the direct cause of the following exception:
request = <SubRequest 'django_db_setup' for <Function test_create_users_test_users_exist>>
django_test_environment = None
django_db_blocker = <pytest_django.plugin._DatabaseBlocker object at 0x7f86a8d45b00>
django_db_use_migrations = True, django_db_keepdb = False
django_db_createdb = False, django_db_modify_db_settings = None
@pytest.fixture(scope="session")
def django_db_setup(
request,
django_test_environment: None,
django_db_blocker,
django_db_use_migrations: bool,
django_db_keepdb: bool,
django_db_createdb: bool,
django_db_modify_db_settings: None,
) -> None:
"""Top level fixture to ensure test databases are available"""
from django.test.utils import setup_databases, teardown_databases
setup_databases_args = {}
if not django_db_use_migrations:
_disable_native_migrations()
if django_db_keepdb and not django_db_createdb:
setup_databases_args["keepdb"] = True
with django_db_blocker.unblock():
db_cfg = setup_databases(
verbosity=request.config.option.verbose,
interactive=False,
> **setup_databases_args
)
.tox/py3/lib/python3.7/site-packages/pytest_django/fixtures.py:120:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/py3/lib/python3.7/site-packages/django/test/utils.py:174: in setup_databases
serialize=connection.settings_dict.get('TEST', {}).get('SERIALIZE', True),
.tox/py3/lib/python3.7/site-packages/django/db/backends/base/creation.py:58: in create_test_db
self._create_test_db(verbosity, autoclobber, keepdb)
.tox/py3/lib/python3.7/site-packages/django/db/backends/base/creation.py:168: in _create_test_db
with self._nodb_connection.cursor() as cursor:
.tox/py3/lib/python3.7/site-packages/django/db/backends/base/base.py:256: in cursor
return self._cursor()
.tox/py3/lib/python3.7/site-packages/django/db/backends/base/base.py:233: in _cursor
self.ensure_connection()
.tox/py3/lib/python3.7/site-packages/django/db/backends/base/base.py:217: in ensure_connection
self.connect()
.tox/py3/lib/python3.7/site-packages/django/db/utils.py:89: in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
.tox/py3/lib/python3.7/site-packages/django/db/backends/base/base.py:217: in ensure_connection
self.connect()
.tox/py3/lib/python3.7/site-packages/django/db/backends/base/base.py:195: in connect
self.connection = self.get_new_connection(conn_params)
.tox/py3/lib/python3.7/site-packages/django/db/backends/postgresql/base.py:178: in get_new_connection
connection = Database.connect(**conn_params)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
dsn = 'dbname=swh-web-test', connection_factory = None, cursor_factory = None
kwargs = {'database': 'swh-web-test'}, kwasync = {}
def connect(dsn=None, connection_factory=None, cursor_factory=None, **kwargs):
"""
Create a new database connection.
The connection parameters can be specified as a string:
conn = psycopg2.connect("dbname=test user=postgres password=secret")
or using a set of keyword arguments:
conn = psycopg2.connect(database="test", user="postgres", password="secret")
Or as a mix of both. The basic connection parameters are:
- *dbname*: the database name
- *database*: the database name (only as keyword argument)
- *user*: user name used to authenticate
- *password*: password used to authenticate
- *host*: database host address (defaults to UNIX socket if not provided)
- *port*: connection port number (defaults to 5432 if not provided)
Using the *connection_factory* parameter a different class or connections
factory can be specified. It should be a callable object taking a dsn
argument.
Using the *cursor_factory* parameter, a new default cursor factory will be
used by cursor().
Using *async*=True an asynchronous connection will be created. *async_* is
a valid alias (for Python versions where ``async`` is a keyword).
Any other keyword parameter will be passed to the underlying client
library: the list of supported parameters depends on the library version.
"""
kwasync = {}
if 'async' in kwargs:
kwasync['async'] = kwargs.pop('async')
if 'async_' in kwargs:
kwasync['async_'] = kwargs.pop('async_')
dsn = _ext.make_dsn(dsn, **kwargs)
> conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
E django.db.utils.OperationalError: could not connect to server: No such file or directory
E Is the server running locally and accepting
E connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
.tox/py3/lib/python3.7/site-packages/psycopg2/__init__.py:122: OperationalError
TEST RESULT
TEST RESULT
- Run At
- Sep 29 2021, 1:52 PM