This is an automated email from the ASF dual-hosted git repository.

fokko pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/iceberg-python.git


The following commit(s) were added to refs/heads/main by this push:
     new ff662c4  Catch warning in PyLint tests (#33)
ff662c4 is described below

commit ff662c4ddb8e43efa15f7969e020bb2e4e7f041d
Author: Fokko Driesprong <[email protected]>
AuthorDate: Mon Nov 6 11:22:57 2023 +0100

    Catch warning in PyLint tests (#33)
    
    * Catch warning in PyLint tests
    
    * Update Setuptools
    
    * Change spaces into a tab
    
    * Ignore Ray warning
---
 pyiceberg/manifest.py          | 10 +++++-----
 pyproject.toml                 |  5 +++++
 tests/catalog/test_sql.py      |  1 +
 tests/conftest.py              |  1 +
 tests/io/test_io.py            |  2 ++
 tests/io/test_pyarrow_stats.py |  1 +
 tests/test_integration.py      |  1 +
 tests/utils/test_manifest.py   |  4 ++--
 8 files changed, 18 insertions(+), 7 deletions(-)

diff --git a/pyiceberg/manifest.py b/pyiceberg/manifest.py
index fdebfee..ec7c218 100644
--- a/pyiceberg/manifest.py
+++ b/pyiceberg/manifest.py
@@ -783,8 +783,8 @@ class ManifestWriterV1(ManifestWriter):
             output_file,
             snapshot_id,
             {
-                "schema": schema.json(),
-                "partition-spec": spec.json(),
+                "schema": schema.model_dump_json(),
+                "partition-spec": spec.model_dump_json(),
                 "partition-spec-id": str(spec.spec_id),
                 "format-version": "1",
             },
@@ -808,9 +808,9 @@ class ManifestWriterV2(ManifestWriter):
             schema,
             output_file,
             snapshot_id,
-            {
-                "schema": schema.json(),
-                "partition-spec": spec.json(),
+            meta={
+                "schema": schema.model_dump_json(),
+                "partition-spec": spec.model_dump_json(),
                 "partition-spec-id": str(spec.spec_id),
                 "format-version": "2",
                 "content": "data",
diff --git a/pyproject.toml b/pyproject.toml
index 34c82a1..6f17719 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -122,6 +122,11 @@ markers = [
   "gcs: marks a test as requiring access to gcs compliant storage (use with 
--gs.token, --gs.project, and --gs.endpoint)"
 ]
 
+# Turns a warning into an error
+filterwarnings = [
+    "error"
+]
+
 [tool.black]
 line-length = 130
 target-version = ['py38']
diff --git a/tests/catalog/test_sql.py b/tests/catalog/test_sql.py
index 41bb5c7..4277845 100644
--- a/tests/catalog/test_sql.py
+++ b/tests/catalog/test_sql.py
@@ -304,6 +304,7 @@ def 
test_create_namespace_with_comment_and_location(test_catalog: SqlCatalog, da
     assert properties["location"] == test_location
 
 
[email protected]("ignore")
 def test_create_namespace_with_null_properties(test_catalog: SqlCatalog, 
database_name: str) -> None:
     with pytest.raises(IntegrityError):
         test_catalog.create_namespace(namespace=database_name, 
properties={None: "value"})  # type: ignore
diff --git a/tests/conftest.py b/tests/conftest.py
index 37ca1e7..4bd1921 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -1546,6 +1546,7 @@ def adlfs_fsspec_fileio(request: pytest.FixtureRequest) 
-> Generator[FsspecFileI
     bbs.create_container("tests")
     yield fsspec.FsspecFileIO(properties=properties)
     bbs.delete_container("tests")
+    bbs.close()
 
 
 @pytest.fixture(scope="session")
diff --git a/tests/io/test_io.py b/tests/io/test_io.py
index c4dc3d4..d27274e 100644
--- a/tests/io/test_io.py
+++ b/tests/io/test_io.py
@@ -288,12 +288,14 @@ def test_load_file_io_location_no_schema() -> None:
     assert isinstance(load_file_io({"location": "/no-schema/"}), PyArrowFileIO)
 
 
[email protected]("ignore")
 def test_mock_warehouse_location_file_io() -> None:
     # For testing the selection logic
     io = load_file_io({"warehouse": "test://some-path/"})
     assert io.properties["warehouse"] == "test://some-path/"
 
 
[email protected]("ignore")
 def test_mock_table_location_file_io() -> None:
     # For testing the selection logic
     io = load_file_io({}, "test://some-path/")
diff --git a/tests/io/test_pyarrow_stats.py b/tests/io/test_pyarrow_stats.py
index 74297fe..6f00061 100644
--- a/tests/io/test_pyarrow_stats.py
+++ b/tests/io/test_pyarrow_stats.py
@@ -76,6 +76,7 @@ from pyiceberg.utils.datetime import date_to_days, 
datetime_to_micros, time_to_m
 
 @dataclass(frozen=True)
 class TestStruct:
+    __test__ = False
     x: Optional[int]
     y: Optional[float]
 
diff --git a/tests/test_integration.py b/tests/test_integration.py
index 6e1c071..7cf017d 100644
--- a/tests/test_integration.py
+++ b/tests/test_integration.py
@@ -194,6 +194,7 @@ def test_pyarrow_limit(table_test_limit: Table) -> None:
     assert len(full_result) == 10
 
 
[email protected]("ignore")
 @pytest.mark.integration
 def test_ray_nan(table_test_null_nan_rewritten: Table) -> None:
     ray_dataset = table_test_null_nan_rewritten.scan().to_ray()
diff --git a/tests/utils/test_manifest.py b/tests/utils/test_manifest.py
index 4d55610..08906b6 100644
--- a/tests/utils/test_manifest.py
+++ b/tests/utils/test_manifest.py
@@ -343,8 +343,8 @@ def test_write_manifest(
                 writer.add_entry(manifest_entries[0])
 
         expected_metadata = {
-            "schema": test_schema.json(),
-            "partition-spec": test_spec.json(),
+            "schema": test_schema.model_dump_json(),
+            "partition-spec": test_spec.model_dump_json(),
             "partition-spec-id": str(test_spec.spec_id),
             "format-version": str(format_version),
         }

Reply via email to