cli_runner = <click.testing.CliRunner object at 0x7f9b705c7cf8>
postgresql = <connection object at 0x7f9b73411548; dsn: 'user=postgres password=xxx dbname=tests host=127.0.0.1 port=30437 options=''', closed: 0>
mock_package_sql = <function mock_package_sql.<locals>.get_sql_for_package_mock at 0x7f9b70577f28>
mocker = <pytest_mock.plugin.MockerFixture object at 0x7f9b705c74a8>
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, 2:35 PM