Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Catch warning in PyLint tests #33

Merged
merged 8 commits into from
Nov 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions pyiceberg/manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -783,8 +783,8 @@ def __init__(self, spec: PartitionSpec, schema: Schema, output_file: OutputFile,
output_file,
snapshot_id,
{
"schema": schema.json(),
"partition-spec": spec.json(),
"schema": schema.model_dump_json(),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.json() is deprecated and will be replaced with .model_dump_json()

"partition-spec": spec.model_dump_json(),
"partition-spec-id": str(spec.spec_id),
"format-version": "1",
},
Expand All @@ -808,9 +808,9 @@ def __init__(self, spec: PartitionSpec, schema: Schema, output_file: OutputFile,
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",
Expand Down
5 changes: 5 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand Down
1 change: 1 addition & 0 deletions tests/catalog/test_sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,7 @@ def test_create_namespace_with_comment_and_location(test_catalog: SqlCatalog, da
assert properties["location"] == test_location


@pytest.mark.filterwarnings("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
Expand Down
1 change: 1 addition & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -1545,6 +1545,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")
Expand Down
2 changes: 2 additions & 0 deletions tests/io/test_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,12 +288,14 @@ def test_load_file_io_location_no_schema() -> None:
assert isinstance(load_file_io({"location": "/no-schema/"}), PyArrowFileIO)


@pytest.mark.filterwarnings("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/"


@pytest.mark.filterwarnings("ignore")
def test_mock_table_location_file_io() -> None:
# For testing the selection logic
io = load_file_io({}, "test://some-path/")
Expand Down
1 change: 1 addition & 0 deletions tests/io/test_pyarrow_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@

@dataclass(frozen=True)
class TestStruct:
__test__ = False
x: Optional[int]
y: Optional[float]

Expand Down
1 change: 1 addition & 0 deletions tests/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ def test_pyarrow_limit(table_test_limit: Table) -> None:
assert len(full_result) == 10


@pytest.mark.filterwarnings("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()
Expand Down
4 changes: 2 additions & 2 deletions tests/utils/test_manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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),
}
Expand Down