request = <SubRequest 'swh_storage_postgresql' for <Function test_iter_origin_visits>>
@pytest.fixture
def postgresql_factory(request: FixtureRequest):
"""Fixture factory for PostgreSQL.
:param FixtureRequest request: fixture request object
:rtype: psycopg2.connection
:returns: postgresql client
"""
config = factories.get_config(request)
proc_fixture = request.getfixturevalue(process_fixture_name)
pg_host = proc_fixture.host
pg_port = proc_fixture.port
pg_user = proc_fixture.user
pg_options = proc_fixture.options
pg_db = db_name or config["dbname"]
with SWHDatabaseJanitor(
pg_user,
pg_host,
pg_port,
pg_db,
proc_fixture.version,
dump_files=dump_files,
> no_truncate_tables=no_truncate_tables,
):
.tox/py3/lib/python3.7/site-packages/swh/core/db/pytest_plugin.py:163:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/py3/lib/python3.7/site-packages/pytest_postgresql/janitor.py:91: in __enter__
self.init()
.tox/py3/lib/python3.7/site-packages/swh/core/db/pytest_plugin.py:111: in init
self.db_reset()
.tox/py3/lib/python3.7/site-packages/swh/core/db/pytest_plugin.py:75: in db_reset
dbname=self.db_name, user=self.user, host=self.host, port=self.port,
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
dsn = 'dbname=storage user=postgres host=127.0.0.1 port=14622'
connection_factory = None, cursor_factory = None
kwargs = {'dbname': 'storage', 'host': '127.0.0.1', 'port': 14622, 'user': 'postgres'}
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_')
if dsn is None and not kwargs:
raise TypeError('missing dsn and no parameters')
dsn = _ext.make_dsn(dsn, **kwargs)
> conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
E psycopg2.OperationalError: FATAL: sorry, too many clients already
.tox/py3/lib/python3.7/site-packages/psycopg2/__init__.py:127: OperationalError
TEST RESULT
TEST RESULT
- Run At
- Jan 20 2021, 2:09 PM