Skip to content

Commit

Permalink
Catch warning in PyLint tests (#33)
Browse files Browse the repository at this point in the history
* Catch warning in PyLint tests

* Update Setuptools

* Change spaces into a tab

* Ignore Ray warning
  • Loading branch information
Fokko authored Nov 6, 2023
1 parent 4563a54 commit ff662c4
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 7 deletions.
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(),
"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 @@ -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")
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

0 comments on commit ff662c4

Please sign in to comment.