westonpace commented on code in PR #12672:
URL: https://github.com/apache/arrow/pull/12672#discussion_r873979165


##########
python/pyarrow/tests/test_substrait.py:
##########
@@ -0,0 +1,108 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+import os
+import sys
+import pathlib
+import pytest
+
+import pyarrow as pa
+from pyarrow.lib import tobytes
+from pyarrow.lib import ArrowInvalid
+
+try:
+    import pyarrow.parquet as pq
+except ImportError:
+    pq = None
+
+try:
+    import pyarrow.substrait as substrait
+except ImportError:
+    substrait = None
+
+# Marks all of the tests in this module
+# Ignore these with pytest ... -m 'not substrait'
+pytestmark = [pytest.mark.parquet, pytest.mark.substrait]
+
+
+def resource_root():
+    """Get the path to the test resources directory."""
+    if not os.environ.get("PARQUET_TEST_DATA"):

Review Comment:
   Ah, I see now.  I guess I'm not sure how this addresses @pitrou 's concerns? 
 It is still reading a parquet file from the parquet test data.  I think 
Antoine was suggesting something like...
   
   ```
   def test_substrait_ipc(tempdir):
       path = tempdir / "some_file.ipc"
       my_table = pa.table([[1, 2, 3, 4, 5]], names=['f0'])
       with ipc.RecordBatchFileWriter(path, schema=my_table.schema) as writer:
           writer.write_table(my_table)
       substrait_query = ...
       query = tobytes(substrait_query.replace("FILENAME_PLACEHOLDER", path))
       ...
       assert my_table == res_tb
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to