diff --git a/python/tests/pyspark_integration/test_write_to_pyspark.py b/python/tests/pyspark_integration/test_write_to_pyspark.py index 167f3dfd32..897746f694 100644 --- a/python/tests/pyspark_integration/test_write_to_pyspark.py +++ b/python/tests/pyspark_integration/test_write_to_pyspark.py @@ -5,18 +5,11 @@ import pytest from deltalake import write_deltalake -from deltalake.deltalake import PyDeltaTableError +from deltalake._internal import PyDeltaTableError +from deltalake.writer import DeltaTableProtocolError from .utils import assert_spark_read_equal, get_spark -try: - from pandas.testing import assert_frame_equal -except ModuleNotFoundError: - _has_pandas = False -else: - _has_pandas = True - - try: import delta import delta.pip_utils @@ -89,6 +82,7 @@ def test_write_invariant(tmp_path: pathlib.Path): with pytest.raises( PyDeltaTableError, match="Invariant \(c1 > 3\) violated by value .+2" ): + # raise PyDeltaTableError("test") write_deltalake(str(tmp_path), invalid_data, mode="overwrite") # Can write valid data to the table @@ -115,7 +109,7 @@ def test_checks_min_writer_version(tmp_path: pathlib.Path): spark.sql(f"ALTER TABLE delta.`{str(tmp_path)}` ADD CONSTRAINT x CHECK (c1 > 2)") with pytest.raises( - PyDeltaTableError, match="This table's min_writer_version is 3, but" + DeltaTableProtocolError, match="This table's min_writer_version is 3, but" ): valid_data = pa.table({"c1": pa.array([5, 6])}) write_deltalake(str(tmp_path), valid_data, mode="append") diff --git a/python/tests/test_writer.py b/python/tests/test_writer.py index 23f6c37cec..cda1c3601e 100644 --- a/python/tests/test_writer.py +++ b/python/tests/test_writer.py @@ -420,7 +420,7 @@ def test_writer_null_stats(tmp_path: pathlib.Path): def test_writer_fails_on_protocol(existing_table: DeltaTable, sample_data: pa.Table): - existing_table.protocol = Mock(return_value=ProtocolVersions(1, 2)) + existing_table.protocol = Mock(return_value=ProtocolVersions(1, 3)) with pytest.raises(DeltaTableProtocolError): write_deltalake(existing_table, sample_data, mode="overwrite")