Skip to content

Commit

Permalink
Add DeltaTableError in Python binding. Add markers for integration te…
Browse files Browse the repository at this point in the history
…sts with pytest. (#496)
  • Loading branch information
fvaleye authored Nov 14, 2021
1 parent 8a499eb commit 36d56ec
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 4 deletions.
2 changes: 1 addition & 1 deletion python/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "deltalake-python"
version = "0.5.3"
version = "0.5.4"
authors = ["Qingping Hou <dave2008713@gmail.com>"]
homepage = "https://github.com/delta-io/delta-rs"
license = "Apache-2.0"
Expand Down
2 changes: 1 addition & 1 deletion python/deltalake/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from .data_catalog import DataCatalog
from .deltalake import RawDeltaTable, rust_core_version
from .deltalake import PyDeltaTableError, RawDeltaTable, rust_core_version
from .schema import DataType, Field, Schema
from .table import DeltaTable, Metadata
2 changes: 1 addition & 1 deletion python/deltalake/fs.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def create_dir(self, path: str, *, recursive: bool = True) -> None:
Create a directory and subdirectories.
This function succeeds if the directory already exists.
:param path: The path of the new directory.
:param recursive: Create nested directories as well.
"""
Expand Down
4 changes: 4 additions & 0 deletions python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,8 @@ exclude = "venv"
addopts = "--cov=deltalake -v -m 'not integration'"
testpaths = [
"tests",
]
markers = [
"integration: marks tests as integration tests (deselect with '-m \"not integration\"')",
"s3: marks tests as integration tests with S3 (deselect with '-m \"not s3\"')",
]
2 changes: 1 addition & 1 deletion python/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,6 @@ fn deltalake(py: Python, m: &PyModule) -> PyResult<()> {
m.add_class::<RawDeltaTable>()?;
m.add_class::<RawDeltaTableMetaData>()?;
m.add_class::<DeltaStorageFsBackend>()?;
m.add("DeltaTableError", py.get_type::<PyDeltaTableError>())?;
m.add("PyDeltaTableError", py.get_type::<PyDeltaTableError>())?;
Ok(())
}
1 change: 1 addition & 0 deletions python/stubs/deltalake/deltalake.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from typing import Any, Callable

RawDeltaTable: Any
PyDeltaTableError: Any
rust_core_version: Callable[[], str]
DeltaStorageFsBackend: Any
6 changes: 6 additions & 0 deletions python/tests/test_table_read.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,12 @@ def test_delta_table_with_filesystem():
assert dt.to_pandas(filesystem=filesystem).equals(pd.DataFrame({"id": [5, 7, 9]}))


def test_import_delta_table_error():
from deltalake import PyDeltaTableError

PyDeltaTableError()


class ExcPassThroughThread(Thread):
"""Wrapper around `threading.Thread` that propagates exceptions."""

Expand Down

0 comments on commit 36d56ec

Please sign in to comment.