cli_runner = <click.testing.CliRunner object at 0x7f9b0dfb1630>
postgresql = <connection object at 0x7f9b10c0f408; dsn: 'user=postgres password=xxx dbname=tests host=127.0.0.1 port=18610 options=''', closed: 0>
mock_import_swhmodule = <function mock_import_swhmodule.<locals>.import_swhmodule_mock at 0x7f9b0dfeb6a8>
mocker = <pytest_mock.plugin.MockerFixture object at 0x7f9b0dfb1470>
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_import_swhmodule, mocker, tmp_path
):
"""Create a db then initializing it should be ok for a "new style" datastore"""
module_name = "test.cli_new"
conninfo = craft_conninfo(postgresql)
# This initializes the schema and data
cfgfile = tmp_path / "config.yml"
cfgfile.write_text(yaml.dump({module_name: {"cls": "postgresql", "db": conninfo}}))
result = cli_runner.invoke(swhdb, ["init-admin", module_name, "--dbname", conninfo])
assert result.exit_code == 0, f"Unexpected output: {result.output}"
result = cli_runner.invoke(swhdb, ["-C", cfgfile, "init", module_name])
> assert (
result.exit_code == 0
), f"Unexpected output: {traceback.print_tb(result.exc_info[2])}"
E AssertionError: Unexpected output: None
E assert 1 == 0
E + where 1 = <Result ProgrammingError("can't adapt type 'MagicMock'")>.exit_code
.tox/py3-core-db-server-github-slow-cover/lib/python3.7/site-packages/swh/core/db/tests/test_cli.py:228: AssertionError
TEST RESULT
TEST RESULT
- Run At
- May 30 2022, 4:45 PM