You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sedona.apache.org by pa...@apache.org on 2026/04/17 17:14:28 UTC

(sedona-db) branch main updated: chore(ci): Provide valid location for bigquery cache for wheel tests (#770)

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

paleolimbot pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/sedona-db.git


The following commit(s) were added to refs/heads/main by this push:
     new e1352bbbd  chore(ci): Provide valid location for bigquery cache for wheel tests (#770)
e1352bbbd is described below

commit e1352bbbdf52d24980c93652c9fdfb8dd684045d
Author: Dewey Dunnington <de...@dunnington.ca>
AuthorDate: Fri Apr 17 12:14:21 2026 -0500

     chore(ci): Provide valid location for bigquery cache for wheel tests (#770)
---
 python/sedonadb/python/sedonadb/testing.py  | 17 +++++++++++++++--
 python/sedonadb/tests/geography/conftest.py | 24 ++++++++++++++++++++++++
 2 files changed, 39 insertions(+), 2 deletions(-)

diff --git a/python/sedonadb/python/sedonadb/testing.py b/python/sedonadb/python/sedonadb/testing.py
index 3bda13629..8ca0dd930 100644
--- a/python/sedonadb/python/sedonadb/testing.py
+++ b/python/sedonadb/python/sedonadb/testing.py
@@ -677,11 +677,24 @@ class BigQuery(DBEngine):
     much faster as opening a connection to BigQuery is slow).
     """
 
-    _CACHE_DIR = Path(__file__).resolve().parent.parent.parent / "tests" / "geography"
+    _CACHE_DIR: "Path | None" = None
     _shared_cache: "ArrowSQLCache | None" = None
 
+    @classmethod
+    def set_cache_dir(cls, cache_dir: "Path | str") -> None:
+        """Set the directory containing bigquery_cache.yml.
+
+        Call this before any BigQuery instances are created to configure
+        where the cache file is located. This is typically called from a
+        conftest.py in the test directory.
+        """
+        cls._CACHE_DIR = Path(cache_dir)
+        cls._shared_cache = None  # Reset so next instance uses new path
+
     def __init__(self, cache_path: "Path | None" = None):
-        self._cache_path = cache_path or self._CACHE_DIR / "bigquery_cache.yml"
+        if cache_path is None and BigQuery._CACHE_DIR is not None:
+            cache_path = BigQuery._CACHE_DIR / "bigquery_cache.yml"
+        self._cache_path = cache_path
         if cache_path is not None or BigQuery._shared_cache is None:
             BigQuery._shared_cache = ArrowSQLCache("bigquery", self._cache_path)
         self._file_cache = BigQuery._shared_cache
diff --git a/python/sedonadb/tests/geography/conftest.py b/python/sedonadb/tests/geography/conftest.py
new file mode 100644
index 000000000..a63c2e6d4
--- /dev/null
+++ b/python/sedonadb/tests/geography/conftest.py
@@ -0,0 +1,24 @@
+# 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.
+
+from pathlib import Path
+from sedonadb.testing import BigQuery
+
+# Set the BigQuery cache directory based on this file's location.
+# This ensures the cache is found when tests run from an installed wheel
+# (where the testing.py module's relative path calculation would fail).
+BigQuery.set_cache_dir(Path(__file__).resolve().parent)