Skip to content

Commit ff662c4

Browse files
authored
Catch warning in PyLint tests (#33)
* Catch warning in PyLint tests * Update Setuptools * Change spaces into a tab * Ignore Ray warning
1 parent 4563a54 commit ff662c4

File tree

8 files changed

+18
-7
lines changed

8 files changed

+18
-7
lines changed

pyiceberg/manifest.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -783,8 +783,8 @@ def __init__(self, spec: PartitionSpec, schema: Schema, output_file: OutputFile,
783783
output_file,
784784
snapshot_id,
785785
{
786-
"schema": schema.json(),
787-
"partition-spec": spec.json(),
786+
"schema": schema.model_dump_json(),
787+
"partition-spec": spec.model_dump_json(),
788788
"partition-spec-id": str(spec.spec_id),
789789
"format-version": "1",
790790
},
@@ -808,9 +808,9 @@ def __init__(self, spec: PartitionSpec, schema: Schema, output_file: OutputFile,
808808
schema,
809809
output_file,
810810
snapshot_id,
811-
{
812-
"schema": schema.json(),
813-
"partition-spec": spec.json(),
811+
meta={
812+
"schema": schema.model_dump_json(),
813+
"partition-spec": spec.model_dump_json(),
814814
"partition-spec-id": str(spec.spec_id),
815815
"format-version": "2",
816816
"content": "data",

pyproject.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,11 @@ markers = [
122122
"gcs: marks a test as requiring access to gcs compliant storage (use with --gs.token, --gs.project, and --gs.endpoint)"
123123
]
124124

125+
# Turns a warning into an error
126+
filterwarnings = [
127+
"error"
128+
]
129+
125130
[tool.black]
126131
line-length = 130
127132
target-version = ['py38']

tests/catalog/test_sql.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,7 @@ def test_create_namespace_with_comment_and_location(test_catalog: SqlCatalog, da
304304
assert properties["location"] == test_location
305305

306306

307+
@pytest.mark.filterwarnings("ignore")
307308
def test_create_namespace_with_null_properties(test_catalog: SqlCatalog, database_name: str) -> None:
308309
with pytest.raises(IntegrityError):
309310
test_catalog.create_namespace(namespace=database_name, properties={None: "value"}) # type: ignore

tests/conftest.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1546,6 +1546,7 @@ def adlfs_fsspec_fileio(request: pytest.FixtureRequest) -> Generator[FsspecFileI
15461546
bbs.create_container("tests")
15471547
yield fsspec.FsspecFileIO(properties=properties)
15481548
bbs.delete_container("tests")
1549+
bbs.close()
15491550

15501551

15511552
@pytest.fixture(scope="session")

tests/io/test_io.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,12 +288,14 @@ def test_load_file_io_location_no_schema() -> None:
288288
assert isinstance(load_file_io({"location": "/no-schema/"}), PyArrowFileIO)
289289

290290

291+
@pytest.mark.filterwarnings("ignore")
291292
def test_mock_warehouse_location_file_io() -> None:
292293
# For testing the selection logic
293294
io = load_file_io({"warehouse": "test://some-path/"})
294295
assert io.properties["warehouse"] == "test://some-path/"
295296

296297

298+
@pytest.mark.filterwarnings("ignore")
297299
def test_mock_table_location_file_io() -> None:
298300
# For testing the selection logic
299301
io = load_file_io({}, "test://some-path/")

tests/io/test_pyarrow_stats.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@
7676

7777
@dataclass(frozen=True)
7878
class TestStruct:
79+
__test__ = False
7980
x: Optional[int]
8081
y: Optional[float]
8182

tests/test_integration.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@ def test_pyarrow_limit(table_test_limit: Table) -> None:
194194
assert len(full_result) == 10
195195

196196

197+
@pytest.mark.filterwarnings("ignore")
197198
@pytest.mark.integration
198199
def test_ray_nan(table_test_null_nan_rewritten: Table) -> None:
199200
ray_dataset = table_test_null_nan_rewritten.scan().to_ray()

tests/utils/test_manifest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -343,8 +343,8 @@ def test_write_manifest(
343343
writer.add_entry(manifest_entries[0])
344344

345345
expected_metadata = {
346-
"schema": test_schema.json(),
347-
"partition-spec": test_spec.json(),
346+
"schema": test_schema.model_dump_json(),
347+
"partition-spec": test_spec.model_dump_json(),
348348
"partition-spec-id": str(test_spec.spec_id),
349349
"format-version": str(format_version),
350350
}

0 commit comments

Comments
 (0)