monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7fe6bb86f0f0>
postgresql = <connection object at 0x7fe6bb809048; dsn: 'user=postgres password=xxx dbname=tests host=127.0.0.1 port=25914 options=''', closed: 0>
flavor = 'without-path'
dbtables = {'content', 'content_in_directory', 'content_in_revision', 'dbflavor', 'dbversion', 'directory', ...}
@pytest.mark.parametrize(
"flavor, dbtables", (("with-path", TABLES | {"location"}), ("without-path", TABLES))
)
def test_cli_db_create_and_init_db_with_flavor(
monkeypatch, # TODO: add proper type annotation
postgresql: psycopg2.extensions.connection,
flavor: str,
dbtables: Set[str],
) -> None:
"""Test that 'swh db init provenance' works with flavors
for both with-path and without-path flavors"""
dbname = f"{flavor}-db"
# DB creation using 'swh db create'
db_params = postgresql.get_dsn_parameters()
monkeypatch.setenv("PGHOST", db_params["host"])
monkeypatch.setenv("PGUSER", db_params["user"])
monkeypatch.setenv("PGPORT", db_params["port"])
result = CliRunner().invoke(swhmain, ["db", "create", "-d", dbname, "provenance"])
assert result.exit_code == 0, result.output
# DB init using 'swh db init'
result = CliRunner().invoke(
swhmain, ["db", "init", "-d", dbname, "--flavor", flavor, "provenance"]
)
> assert result.exit_code == 0, result.output
E AssertionError:
E assert 1 == 0
E +1
E -0
.tox/py3/lib/python3.7/site-packages/swh/provenance/tests/test_cli.py:76: AssertionError
TEST RESULT
TEST RESULT
- Run At
- Jul 22 2021, 9:45 AM