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

JingsongLi pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/paimon-rust.git


The following commit(s) were added to refs/heads/main by this push:
     new f65ff948 ci: run Python binding Rust unit tests (#1241)
f65ff948 is described below

commit f65ff948a26b74a588aedba85ad7463f8da0c210
Author: Jingsong Lee <[email protected]>
AuthorDate: Wed Oct 28 16:42:03 2026 +0800

    ci: run Python binding Rust unit tests (#1241)
---
 .github/workflows/ci.yml     |  5 +++++
 CONTRIBUTING.md              | 11 +++++++++++
 bindings/python/Makefile     |  7 +++++++
 bindings/python/src/write.rs |  2 +-
 4 files changed, 24 insertions(+), 1 deletion(-)

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 74e50e77..600f34bf 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -281,6 +281,11 @@ jobs:
         working-directory: bindings/python
         run: make install && make test
 
+      - name: Python Binding Rust Unit Tests
+        if: matrix.suite == 'python'
+        working-directory: bindings/python
+        run: make test-rust
+
       - name: Go Integration Test
         if: matrix.suite == 'go'
         working-directory: bindings/go
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 6a6ab951..ccad5b6a 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -43,6 +43,17 @@ Set `PAIMON_TEST_WAREHOUSE` to use an existing warehouse 
instead. Missing tables
 fail the tests rather than being skipped or generated by the Rust writer. See
 [the golden 
warehouse](crates/integrations/datafusion/testdata/warehouse/README.md) for 
fixture provenance.
 
+The Python binding has both pytest integration tests and Rust unit tests. Run
+them with the binding's uv environment so the Rust tests link to the same 
Python
+interpreter and can import its PyArrow dependencies, as in CI:
+
+```bash
+cd bindings/python
+make install
+make test
+make test-rust
+```
+
 ### Setting up the Development Environment
 1. Install Rust using `rustup`. Follow the instructions on the [rustup 
website](https://rustup.rs/) to install Rust on your system.
 2. Clone the repository to your local machine.
diff --git a/bindings/python/Makefile b/bindings/python/Makefile
index 21198c9e..dc58f4aa 100644
--- a/bindings/python/Makefile
+++ b/bindings/python/Makefile
@@ -24,3 +24,10 @@ install:
 
 test:
        uv run --no-sync pytest
+
+test-rust:
+       PYO3_PYTHON="$$(uv run --no-sync python -c 'import sys; 
print(sys.executable)')" \
+       PYTHONHOME="$$(uv run --no-sync python -c 'import sys; 
print(sys.base_prefix)')" \
+       PYTHONPATH="$$(uv run --no-sync python -c 'import sysconfig; 
print(sysconfig.get_path("purelib"))')" \
+       LD_LIBRARY_PATH="$$(uv run --no-sync python -c 'import sysconfig; 
print(sysconfig.get_config_var("LIBDIR"))')$${LD_LIBRARY_PATH:+:$$LD_LIBRARY_PATH}"
 \
+       uv run --no-sync cargo test --locked -p pypaimon_rust --lib
diff --git a/bindings/python/src/write.rs b/bindings/python/src/write.rs
index 0e1009c4..a22a1545 100644
--- a/bindings/python/src/write.rs
+++ b/bindings/python/src/write.rs
@@ -3085,7 +3085,7 @@ source = pa.Table.from_pylist([
 invalid = source.slice(0, 1)
 "#
                 ),
-                None,
+                Some(&locals),
                 Some(&locals),
             )
             .unwrap();

Reply via email to