From 4a001e9c586762fda6ae7f1afda3a2a51a5c10d1 Mon Sep 17 00:00:00 2001 From: eladkal <45845474+eladkal@users.noreply.github.com> Date: Fri, 6 May 2022 20:34:01 +0300 Subject: [PATCH] Replace `pytest.mark.xfail` in Postgres tests --- tests/providers/postgres/hooks/test_postgres.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tests/providers/postgres/hooks/test_postgres.py b/tests/providers/postgres/hooks/test_postgres.py index a0d1430e745c8..847260cb88e6a 100644 --- a/tests/providers/postgres/hooks/test_postgres.py +++ b/tests/providers/postgres/hooks/test_postgres.py @@ -315,7 +315,6 @@ def test_insert_rows_replace(self): for row in rows: self.cur.execute.assert_any_call(sql, row) - @pytest.mark.xfail @pytest.mark.backend("postgres") def test_insert_rows_replace_missing_target_field_arg(self): table = "table" @@ -330,9 +329,11 @@ def test_insert_rows_replace_missing_target_field_arg(self): ), ] fields = ("id", "value") - self.db_hook.insert_rows(table, rows, replace=True, replace_index=fields[0]) + with pytest.raises(ValueError) as ctx: + self.db_hook.insert_rows(table, rows, replace=True, replace_index=fields[0]) + + assert str(ctx.value) == "PostgreSQL ON CONFLICT upsert syntax requires column names" - @pytest.mark.xfail @pytest.mark.backend("postgres") def test_insert_rows_replace_missing_replace_index_arg(self): table = "table" @@ -347,7 +348,10 @@ def test_insert_rows_replace_missing_replace_index_arg(self): ), ] fields = ("id", "value") - self.db_hook.insert_rows(table, rows, fields, replace=True) + with pytest.raises(ValueError) as ctx: + self.db_hook.insert_rows(table, rows, fields, replace=True) + + assert str(ctx.value) == "PostgreSQL ON CONFLICT upsert syntax requires an unique index" @pytest.mark.backend("postgres") def test_rowcount(self):