Skip to content
This repository was archived by the owner on Mar 29, 2026. It is now read-only.

fix: skip sanity tests gracefully when optional dependencies are missing#1108

Open
Wmx-5Percent wants to merge 1 commit into
vanna-ai:mainfrom
Wmx-5Percent:fix/skip-sanity-tests-missing-deps
Open

fix: skip sanity tests gracefully when optional dependencies are missing#1108
Wmx-5Percent wants to merge 1 commit into
vanna-ai:mainfrom
Wmx-5Percent:fix/skip-sanity-tests-missing-deps

Conversation

@Wmx-5Percent

Copy link
Copy Markdown

Problem

6 sanity tests fail with ModuleNotFoundError or AttributeError when optional dependencies are not installed, rather than being gracefully skipped:

test_database_sanity.py — 5 failures:

  • TestClickHouseRunner (4 methods) — clickhouse_connect not installed
  • TestOracleRunner (4 methods) — oracledb not installed
  • TestMSSQLRunner (4 methods) — pyodbc not installed
  • TestPrestoRunner (4 methods) — pyhive not installed
  • TestHiveRunner (4 methods) — pyhive not installed

test_agent_memory_sanity.py — 1 failure:

  • TestFAISSAgentMemory::test_faiss_instantiation — asserts memory.persist_path but FAISSAgentMemory stores the path as self.index_path

Fix

1. Database runner tests (test_database_sanity.py)

Added try/except ImportError: pytest.skip(...) guards to all 20 test methods across the 5 affected test classes. This covers both:

  • Module-level ImportError (when the integration module can't be imported)
  • Constructor-level ImportError (when the Runner's __init__ checks for the underlying package)

This follows the exact same pattern already used in test_agent_memory_sanity.py for optional memory backends (ChromaDB, Qdrant, Pinecone, Milvus, Weaviate, FAISS, OpenSearch, AzureAISearch, Marqo).

2. FAISS memory test (test_agent_memory_sanity.py)

Fixed the incorrect attribute assertion: memory.persist_pathmemory.index_path, matching the actual FAISSAgentMemory.__init__ which stores the path as self.index_path.

Before

FAILED tests/test_database_sanity.py::TestClickHouseRunner::test_clickhouse_runner_instantiation - ModuleNotFoundError: No module named 'clickhouse_connect'
FAILED tests/test_database_sanity.py::TestOracleRunner::test_oracle_runner_instantiation - ImportError: oracledb package is required
FAILED tests/test_database_sanity.py::TestMSSQLRunner::test_mssql_runner_instantiation - ImportError: pyodbc package is required
FAILED tests/test_database_sanity.py::TestPrestoRunner::test_presto_runner_instantiation - ImportError: pyhive package is required
FAILED tests/test_database_sanity.py::TestHiveRunner::test_hive_runner_instantiation - ImportError: pyhive package is required
FAILED tests/test_agent_memory_sanity.py::TestFAISSAgentMemory::test_faiss_instantiation - AttributeError: 'FAISSAgentMemory' object has no attribute 'persist_path'

After

SKIPPED tests/test_database_sanity.py::TestClickHouseRunner::test_clickhouse_runner_instantiation - clickhouse_connect not installed
SKIPPED tests/test_database_sanity.py::TestOracleRunner::test_oracle_runner_instantiation - oracledb not installed
SKIPPED tests/test_database_sanity.py::TestMSSQLRunner::test_mssql_runner_instantiation - pyodbc not installed
SKIPPED tests/test_database_sanity.py::TestPrestoRunner::test_presto_runner_instantiation - pyhive not installed
SKIPPED tests/test_database_sanity.py::TestHiveRunner::test_hive_runner_instantiation - pyhive not installed
PASSED tests/test_agent_memory_sanity.py::TestFAISSAgentMemory::test_faiss_instantiation

Test Results

Full local test suite (excluding integration tests requiring API keys):

210 passed, 5 skipped in 5.78s

Checklist

  • ruff format — no changes needed
  • ruff check — all checks passed
  • All existing tests still pass
  • Follows project conventions (commit message format, skip pattern)

- Add try/except ImportError: pytest.skip() guards to 5 database runner
  test classes (ClickHouse, Oracle, MSSQL, Presto, Hive) in
  test_database_sanity.py so they skip instead of fail when optional
  packages (clickhouse_connect, oracledb, pyodbc, pyhive) are not installed.

- Fix incorrect attribute assertion in test_agent_memory_sanity.py:
  FAISSAgentMemory stores the path as 'index_path', not 'persist_path'.

Follows the existing try/except skip pattern used in
test_agent_memory_sanity.py for other optional memory backends.

Before: 6 FAILED (ModuleNotFoundError / AttributeError)
After:  5 SKIPPED, 1 PASSED (previously failing FAISS test now correct)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant