cli_runner = <click.testing.CliRunner object at 0x7fd5f1376908>
postgresql = <connection object at 0x7fd5f338d688; dsn: 'user=postgres password=xxx dbname=tests host=127.0.0.1 port=10785 options=''', closed: 0>
mock_package_sql = <function mock_package_sql.<locals>.get_sql_for_package_mock at 0x7fd5f12229d8>
mocker = <pytest_mock.plugin.MockerFixture object at 0x7fd5f13355c0>
tmp_path = PosixPath('/tmp/pytest-of-jenkins/pytest-0/test_cli_swh_db_create_and_ini0')
def test_cli_swh_db_create_and_init_db_new_api(
cli_runner, postgresql, mock_package_sql, mocker, tmp_path
):
"""Create a db then initializing it should be ok for a "new style" datastore
"""
module_name = "test.cli_new"
def import_swhmodule_mock(modname):
if modname.startswith("test."):
def get_datastore(cls, **kw):
# XXX probably not the best way of doing this...
return MagicMock(get_current_version=lambda: 42)
return MagicMock(name=modname, get_datastore=get_datastore)
return import_swhmodule(modname)
mocker.patch("swh.core.db.db_utils.import_swhmodule", import_swhmodule_mock)
conninfo = craft_conninfo(postgresql)
# This initializes the schema and data
cfgfile = tmp_path / "config.yml"
> cfgfile.write_text(yaml.dumps({module_name: {"cls": "postgresql", "db": conninfo}}))
E AttributeError: module 'yaml' has no attribute 'dumps'
.tox/py3-core-db-server-slow-cover/lib/python3.7/site-packages/swh/core/db/tests/test_cli.py:242: AttributeError
TEST RESULT
TEST RESULT
- Run At
- Feb 11 2022, 3:58 PM