From a01f8ecb0e687653a6d67bd263549cf3b2763b12 Mon Sep 17 00:00:00 2001 From: Taewoon Kim Date: Tue, 6 Oct 2026 14:19:54 +0900 Subject: [PATCH 1/3] tests: no skip stands for a feature the wheel ships, and CI fails any skip nobody accepted (#207) About twenty tests skipped when the engine raised or returned nothing; the docs themselves said a wrong empty answer showed up as a skip. None fired on 26.10.1. They are plain assertions now (OpenCypher, geo, graph algorithms, time series, HASH index, vector encodings, importers, the server stack, the JVM payload check). The two GraphML/GraphSON positive tests, their marker, and helper are deleted: the wheel has no gremlin module and Cypher is the supported graph language. The server skip guard and its helper are gone; test_server_packaging.py keeps stating the requirement. scripts/check_test_skips.py runs in the test job and fails on any skip not on its short list (Windows file name and SIGINT, docs on the upstream PR branch). The faulthandler hook test runs on every platform in a child process: toggling faulthandler in the pytest process after the JVM starts replaces HotSpot's SIGSEGV handler and kills the run with exit 139. Full suite on the official 26.10.1 wheel: 809 passed, 9 xfailed (open upstream #9277, #9278, #9281), 0 skipped. Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_01Ubz3m6QXHESerCkehC1qgi --- .github/workflows/test-python-bindings.yml | 6 + bindings/python/docs/development/ci-setup.md | 17 ++- .../python/docs/development/contributing.md | 7 +- .../development/testing/best-practices.md | 12 +- .../docs/development/testing/overview.md | 47 +++--- .../development/testing/test-docs-examples.md | 4 +- .../docs/development/testing/test-exporter.md | 10 +- .../docs/development/testing/test-jvm-args.md | 2 +- .../testing/test-server-packaging.md | 8 +- .../docs/development/testing/test-server.md | 2 +- bindings/python/pyproject.toml | 1 - bindings/python/scripts/check_test_skips.py | 98 ++++++++++++ bindings/python/tests/README.md | 13 +- bindings/python/tests/conftest.py | 33 ----- .../python/tests/test_check_test_skips.py | 112 ++++++++++++++ .../python/tests/test_columnar_readers.py | 4 +- bindings/python/tests/test_core.py | 33 ++--- bindings/python/tests/test_cypher.py | 21 +-- bindings/python/tests/test_docs_examples.py | 2 - bindings/python/tests/test_exporter.py | 66 +-------- .../python/tests/test_geo_predicate_sql.py | 35 ++--- .../python/tests/test_graph_algorithms_sql.py | 43 ++---- .../python/tests/test_hash_index_schema.py | 46 +++--- bindings/python/tests/test_import_database.py | 140 +++++------------- bindings/python/tests/test_jvm_args.py | 36 ++++- bindings/python/tests/test_jvm_payload.py | 17 +-- bindings/python/tests/test_numpy_support.py | 10 +- bindings/python/tests/test_resultset_arrow.py | 2 +- bindings/python/tests/test_server.py | 7 +- .../python/tests/test_server_packaging.py | 34 +---- bindings/python/tests/test_server_patterns.py | 7 +- bindings/python/tests/test_timeseries_sql.py | 22 +-- bindings/python/tests/test_vector.py | 8 +- .../tests/test_vector_params_verification.py | 23 +-- bindings/python/tests/test_vector_sql.py | 84 ++++------- pyproject.toml | 1 - 36 files changed, 468 insertions(+), 545 deletions(-) create mode 100644 bindings/python/scripts/check_test_skips.py create mode 100644 bindings/python/tests/test_check_test_skips.py diff --git a/.github/workflows/test-python-bindings.yml b/.github/workflows/test-python-bindings.yml index 89d8c9885a4..2cda1b9b135 100644 --- a/.github/workflows/test-python-bindings.yml +++ b/.github/workflows/test-python-bindings.yml @@ -443,6 +443,12 @@ jobs: exit 1 fi + # Any other skip must be one somebody accepted (scripts/check_test_skips.py + # names each, with the platform it applies to and why). A skip because the + # runtime "lacks" a feature the wheel always ships is how a wrong empty answer + # once passed as a skip; the import grep above is the special case. + python scripts/check_test_skips.py test-results.xml --platform "${{ matrix.platform }}" || exit 1 + # Force failure if there are failures or errors if [ "$FAILED" -gt 0 ] || [ "$ERRORS" -gt 0 ]; then echo "❌ Tests failed (failures=$FAILED, errors=$ERRORS)" diff --git a/bindings/python/docs/development/ci-setup.md b/bindings/python/docs/development/ci-setup.md index f9b94c6d588..abe434c07b8 100644 --- a/bindings/python/docs/development/ci-setup.md +++ b/bindings/python/docs/development/ci-setup.md @@ -101,13 +101,16 @@ What must pass before a change is green, beyond the tests themselves: `bindings/python/pyproject.toml` (with the `test`, `vector`, `examples`, `arrow`, and `pandas` extras) are resolved to their lowest allowed versions for every Python version in the classifiers, and `pip-audit` checks the result. -- **No skips for missing imports** (`test` job): the job fails when a skip reason in the - JUnit XML contains `could not import`, which is the reason a `pytest.importorskip` call - without its own `reason=` gives. A custom `reason=` or a hand-written `pytest.skip` is not - caught, so a test for an optional dependency should call `importorskip` without one. A - new test dependency must be added both to the `test` extra in `bindings/python/pyproject.toml` - and to the "Install wheel and test dependencies" step of `test-python-bindings.yml`. - The repo-root `pyproject.toml` carries the same packages for local runs. +- **No unaccepted skips** (`test` job): a skipped test did not run, so the job fails when + any skip in the JUnit XML has a reason that `scripts/check_test_skips.py` does not list. + The list is short and each entry says why the test cannot run on that platform: the + Windows file name and SIGINT tests, and the docs-example tests on the upstream pull + request branch, which has no `docs/`. A skip for a missing package (`could not import`, which is what + `pytest.importorskip` gives, so call it without its own `reason=`) or for a feature the + wheel always ships is therefore a failure, and a new test dependency must be added both + to the `test` extra in `bindings/python/pyproject.toml` and to the "Install wheel and + test dependencies" step of `test-python-bindings.yml`. The repo-root `pyproject.toml` + carries the same packages for local runs. - **Timeouts**: the pytest step has a 30-minute limit, and `faulthandler_timeout = 600` in the pytest configuration dumps every Python thread's stack when a single test runs past 10 minutes. A minute earlier, `tests/conftest.py` writes every Java thread's diff --git a/bindings/python/docs/development/contributing.md b/bindings/python/docs/development/contributing.md index f4889f1246f..bec0dda00ab 100644 --- a/bindings/python/docs/development/contributing.md +++ b/bindings/python/docs/development/contributing.md @@ -315,17 +315,16 @@ uv run pytest -m "not server" uv run pytest -k cypher ``` -The markers in use are `server`, `server_wire`, and `graph_export`; `integration` is registered +The markers in use are `server` and `server_wire`; `integration` is registered but unused. See [Test Markers](testing/overview.md#test-markers) for which tests each one covers and how to leave out every server-starting test. ### Writing Tests Use the shared fixtures in `tests/conftest.py` rather than your own temporary directories. A -server test carries `@pytest.mark.server` and -`@pytest.mark.skipif(not has_server_support(), reason=...)`. One JVM serves the whole session, +server test carries `@pytest.mark.server` and does not skip. One JVM serves the whole session, and engine-wide settings carry from one test to the next, so run the full suite after adding a -test. The fixtures, feature guards, optional dependencies, hang diagnostics, and the Bandit rule +test. The fixtures, what may skip, optional dependencies, hang diagnostics, and the Bandit rule are in [Writing a Test for This Suite](testing/best-practices.md#writing-a-test-for-this-suite). ```python diff --git a/bindings/python/docs/development/testing/best-practices.md b/bindings/python/docs/development/testing/best-practices.md index 1555017acc3..8544dfad799 100644 --- a/bindings/python/docs/development/testing/best-practices.md +++ b/bindings/python/docs/development/testing/best-practices.md @@ -213,9 +213,12 @@ except Exception: 2. **A teardown warns; it never swallows.** A teardown that hides its own failure hides the bug with it. `temp_db` shows the pattern: it closes the database if it is still open and turns a failed close into a warning. -3. **Guard optional features** with `has_server_support()` and `has_graph_export_support()` - from `tests/conftest.py`, and keep a test that never skips beside the guard, as - `test_server_packaging.py` does for the server stack. A server test also carries +3. **Do not skip on what the wheel ships.** A test for the server stack, OpenCypher, or any + other bundled feature runs and fails when the feature is missing: a guard that skips + cannot notice the feature going missing (the server JARs left the wheel in 26.7.2 and + the guarded tests skipped into a green suite). Skip only for an optional Python package, + through `pytest.importorskip` without a custom reason, or for a platform that cannot run + the test; CI fails every other skip (`scripts/check_test_skips.py`). A server test carries `@pytest.mark.server`. 4. **One JVM serves the whole session.** A `start_jvm()` call with a different configuration raises "already started", and engine-wide settings carry from one test to the next, so @@ -237,7 +240,7 @@ except Exception: import pytest import arcadedb_embedded as arcadedb -from tests.conftest import TEST_PASSWORD, has_server_support +from tests.conftest import TEST_PASSWORD def test_insert_is_visible(temp_db): @@ -248,7 +251,6 @@ def test_insert_is_visible(temp_db): @pytest.mark.server -@pytest.mark.skipif(not has_server_support(), reason="Requires server support") def test_server_starts(temp_server_root): with arcadedb.create_server(temp_server_root, root_password=TEST_PASSWORD) as server: assert server.is_started() diff --git a/bindings/python/docs/development/testing/overview.md b/bindings/python/docs/development/testing/overview.md index 3743d0baaaf..57b017dc587 100644 --- a/bindings/python/docs/development/testing/overview.md +++ b/bindings/python/docs/development/testing/overview.md @@ -174,14 +174,13 @@ uv run pytest -vv -s ## Test Markers The markers are registered in `bindings/python/pyproject.toml` (`server`, `server_wire`, -`integration`, and `graph_export`); the repo-root `pyproject.toml` mirrors that block. These are +and `integration`); the repo-root `pyproject.toml` mirrors that block. These are the ones the suite uses: | Marker | Tests | | ------ | ----- | | `server` | `test_server_creation`, `test_server_database_operations`, `test_server_custom_config`, and `test_server_context_manager` in `test_server.py`, `test_server_starts_and_serves_http` in `test_server_packaging.py`, and `test_docs_api_access_examples` in `test_docs_examples.py` | | `server_wire` | Every test in `test_server_wire_protocols.py` (module-level `pytestmark`) | -| `graph_export` | `test_export_graphml` and `test_export_graphson` in `test_exporter.py` | `integration` is registered, but no test uses it. @@ -208,37 +207,29 @@ uv run pytest -m "not server and not server_wire" \ ## Expected Output -A passing run ends with a summary of the form `N passed, M skipped`, with no failures or -errors. On the shipped wheel some tests always skip: `test_export_graphml` and -`test_export_graphson` (the wheel excludes arcadedb-gremlin), and, everywhere except Windows, -`test_faulthandler_is_off_on_windows`. Run with `-rs` to see why each test skipped. +A passing run ends with a summary of the form `N passed, M skipped, K xfailed`, with no +failures or errors. The strict xfails are the engine bugs listed on the Known Engine Issues +page; on Linux and macOS nothing skips. Run with `-rs` to see why a test skipped. ## Skips -Beyond the tests above, a test skips when what it needs is missing: +A skip is a test that did not run, so the suite keeps them to what cannot run: +- **The platform**: on Windows, `test_importer_api.py` skips a file name with a question mark and + `test_sigint.py` skips its child-process interrupts. +- **The upstream pull request branch has no `docs/`**: `test_docs_examples.py` skips there. - **An optional Python package**: numpy, pandas, pyarrow, requests, psycopg, - adbc-driver-postgresql, or neo4j. -- **Server support**: the tests marked `server` in `test_server.py` and - `test_docs_api_access_examples` skip when the wheel carries no Studio JAR. - `test_server_packaging.py` fails instead, so a wheel without the server stack cannot pass - quietly. -- **An engine feature the runtime lacks**: OpenCypher and some of its clauses, the geo and - graph-algorithm SQL functions, `CREATE TIMESERIES TYPE`, the HASH index type, some vector - index options, and the Neo4j, Word2Vec, and RDF importers. Most of these skip on the error - the engine raises. The OpenCypher `collect`/`UNWIND` and pattern-comprehension tests skip - when the query returns no rows or a null, so a wrong empty answer shows up as a skip. -- **A file outside the package**: `bindings/python/docs` (the docs-example tests), - `examples/11_vector_index_build.py`, the importer fixtures under - `integration/src/test/resources/`, and `benchmarks/experiments` (the JVM-payload check). -- **The platform**: the XML and RDF import tests skip on their known Windows parse failures. - -CI fails the job when a skip reason contains "could not import", the default reason of -`pytest.importorskip`, so most missing packages are caught. A skip with its own reason (the -pyarrow module skip in `test_resultset_arrow.py`, the numpy `skipif` in -`test_numpy_support.py`) or a hand-written `pytest.skip` (the requests check in -`test_server_patterns.py`) is not caught, and none of the other conditions above fails the -job. See [CI Gates](../ci-setup.md#ci-gates). + adbc-driver-postgresql, or neo4j, through `pytest.importorskip`, so a missing one is + visible to the CI gate below. + +A test never skips because the engine or the wheel lacks a feature it ships (OpenCypher, +geo and graph-algorithm SQL functions, time series, the HASH index, vector encodings, the +importers, the server stack): that is a failure. Earlier versions of these tests skipped on +the engine's error or on an empty answer, which let a wrong empty answer pass as a skip. + +CI enforces this: the `test` job runs `scripts/check_test_skips.py` over the JUnit XML and +fails on any skip whose reason is not on its short list (`tests/test_check_test_skips.py` +tests the gate). See [CI Gates](../ci-setup.md#ci-gates). ## Next Steps diff --git a/bindings/python/docs/development/testing/test-docs-examples.md b/bindings/python/docs/development/testing/test-docs-examples.md index ba4d69cf493..4b4dceba366 100644 --- a/bindings/python/docs/development/testing/test-docs-examples.md +++ b/bindings/python/docs/development/testing/test-docs-examples.md @@ -36,7 +36,7 @@ The file uses a few complementary approaches: - extract Python fences from Markdown pages - execute standalone snippets in subprocesses - wrap progressive guide snippets with seeded database setup when the page assumes prior context -- keep server-specific cases behind the existing server support checks +- mark server-specific cases `server` This is intentionally broader than a smoke test, but it does not try to execute every Python fence in the docs tree. @@ -48,7 +48,7 @@ Page paths are relative to `bindings/python/docs/`. - `test_docs_installation_and_distribution_examples`: blocks from `getting-started/installation.md` and `getting-started/distributions.md`. - `test_docs_index_and_quickstart_examples`: blocks from `index.md` and `getting-started/quickstart.md`. The batch-insert snippet it also runs is a copy of the quickstart's, written in the test rather than extracted from the page, so an edit to that quickstart block is not caught. -- `test_docs_api_access_examples`: the access-path blocks from `api-access-methods.md`. It is marked `server`, and it skips without server support or without `requests`. +- `test_docs_api_access_examples`: the access-path blocks from `api-access-methods.md`. It is marked `server`, and it skips without `requests` (`importorskip`). - `test_docs_transaction_examples`: blocks from `guide/core/transactions.md`. - `test_docs_example_pages`: the `INSERT INTO Task SET` block from `examples/01_simple_document_store.md`, run against a seeded `Task` schema. The social-network script in the same test is written in the test itself, not read from `examples/02_social_network_graph.md`, so an edit to that page is not caught; the script asserts the rows returned by one SQL `MATCH` query and one OpenCypher query. - `test_docs_core_query_examples`: blocks from `guide/core/queries.md`, several of them run inside a database seeded with the data the page assumes. diff --git a/bindings/python/docs/development/testing/test-exporter.md b/bindings/python/docs/development/testing/test-exporter.md index c63f129c40b..b56c07e69b2 100644 --- a/bindings/python/docs/development/testing/test-exporter.md +++ b/bindings/python/docs/development/testing/test-exporter.md @@ -2,7 +2,7 @@ [View source code]({{ config.repo_url }}/blob/{{ config.extra.version_tag }}/bindings/python/tests/test_exporter.py){ .md-button } -The test classes cover JSONL (with type/edge filters), GraphML/GraphSON (skipped if GraphSON support is unavailable), CSV, round-trip (export→import), bulk insert (chunked transactions), and all data types. +The test classes cover JSONL (with type/edge filters), the error GraphML/GraphSON raise (the wheel has no gremlin module), CSV, round-trip (export→import), bulk insert (chunked transactions), and all data types. ## Test Classes & Cases @@ -20,9 +20,7 @@ Fixture `sample_db` creates 20 users, 15 movies, 10 actors, 50 Rated edges, 30 A - **export_invalid_format**: Passes `format="invalid_format"`; asserts raises `ArcadeDBError` with "invalid" or "format". -- **export_graphml/export_graphson**: Both attempt export; if GraphSON support is missing, skip with `pytest.skip(...)`. The wheel excludes the `arcadedb-gremlin` jar that provides these formats (`scripts/jar_exclusions.txt`), and the `skipif` guard looks for an `arcadedb-gremlin` jar, so on a packaged build both tests are skipped. - -- **graph_formats_without_gremlin_raise_and_name_jsonl** (parametrized over `graphml` and `graphson`, runs only when `arcadedb-gremlin` is absent, which is the packaged wheel): asserts `export_database` raises `ArcadeDBError` saying the format "requires additional modules" and naming `jsonl`. +- **graph_formats_without_gremlin_raise_and_name_jsonl** (parametrized over `graphml` and `graphson`; the wheel excludes `arcadedb-gremlin`, which provides both exporters, and Cypher is the supported graph language): asserts `export_database` raises `ArcadeDBError` saying the format "requires additional modules" and naming `jsonl`. - **export_verbose_levels**: Tests `verbose` parameter (0, 1, 2); asserts `"totalRecords"` in stats for each. @@ -76,7 +74,7 @@ db.command("sql", "IMPORT DATABASE file:///path/to/export.jsonl.tgz") ## Key Observations - Export paths use `exports/` subdirectory relative to cwd -- Stats keys asserted: `totalRecords`, `vertices`, `edges`, and `documents` (JSONL), and `elapsedInSecs` (GraphML/GraphSON) -- GraphML/GraphSON skip when GraphSON support is unavailable, which is the case for the packaged wheel; others raise on bad format +- Stats keys asserted: `totalRecords`, `vertices`, `edges`, and `documents` (JSONL) +- An unknown or gremlin-only format raises `ArcadeDBError` - CSV export supports custom fieldnames and header row - Round-trip: file path must use `file://` URL format and forward slashes (cross-platform compat) diff --git a/bindings/python/docs/development/testing/test-jvm-args.md b/bindings/python/docs/development/testing/test-jvm-args.md index 6e1dd9c7cf3..1ad1c87c3f4 100644 --- a/bindings/python/docs/development/testing/test-jvm-args.md +++ b/bindings/python/docs/development/testing/test-jvm-args.md @@ -22,7 +22,7 @@ Covers JVM argument construction for the embedded runtime. - `ARCADEDB_JVM_ERROR_FILE` handling via `-XX:ErrorFile=...`. - `common_pool_parallelism`: injecting `-Djava.util.concurrent.ForkJoinPool.common.parallelism=`, overriding any env-provided value, and rejecting values below 1. - `conftest.py` defines each `pytest_*` hook once (counted from its AST). -- On Windows, faulthandler is off while the tests run (skipped elsewhere). +- The conftest hook turns faulthandler off on Windows only: the test runs the hook for `win32`, `linux`, and `darwin` on every platform, and on Windows it also checks the session's real state. - `conftest.dump_java_threads()` lists the JVM's threads with their states and stacks; the conftest timer calls it for a test still running after `ARCADEDB_TEST_JAVA_DUMP_AFTER_S` seconds (540 by default), so a hang inside a Java call leaves the Java side in the CI log (humemai/arcadedb-embedded-python#10). ## Run diff --git a/bindings/python/docs/development/testing/test-server-packaging.md b/bindings/python/docs/development/testing/test-server-packaging.md index e6b92bc3abc..447456aa989 100644 --- a/bindings/python/docs/development/testing/test-server-packaging.md +++ b/bindings/python/docs/development/testing/test-server-packaging.md @@ -14,15 +14,11 @@ A JAR is present for each of `arcadedb-server`, `arcadedb-studio`, `undertow-cor create_server / ArcadeDBServer are importable AND in __all__. -### 3) has server support agrees with reality - -`has_server_support()`, the skip guard the other server tests rely on, returns True exactly when a studio JAR is present. - -### 4) studio jar carries no classes +### 3) studio jar carries no classes The studio JAR is present and contains no `.class` entries: Studio is static assets only, which is why bundling it is cheap. -### 5) server starts and serves http +### 4) server starts and serves http Marked `server`; skips without `requests`. The bundled server starts, and `GET /api/v1/server` returns 200 with a `version` field. diff --git a/bindings/python/docs/development/testing/test-server.md b/bindings/python/docs/development/testing/test-server.md index 6e702e900b4..3d79dd5f0ef 100644 --- a/bindings/python/docs/development/testing/test-server.md +++ b/bindings/python/docs/development/testing/test-server.md @@ -4,7 +4,7 @@ These tests cover server creation, database operations, custom config, context managers, and the default host. For advanced patterns (embedded + HTTP), see [Server Patterns](test-server-patterns.md). -Note: the tests construct the server directly with the `ArcadeDBServer` class. Every test except `test_default_host_is_localhost` is marked `@pytest.mark.server` and is skipped unless server support is available. +Note: the tests construct the server directly with the `ArcadeDBServer` class. Every test except `test_default_host_is_localhost` is marked `@pytest.mark.server`. None skips: the wheel always ships the server stack, and a missing one fails these tests. ## Quick Example diff --git a/bindings/python/pyproject.toml b/bindings/python/pyproject.toml index 5aa630ba6c7..b4e972b2c95 100644 --- a/bindings/python/pyproject.toml +++ b/bindings/python/pyproject.toml @@ -136,7 +136,6 @@ markers = [ "server: tests that require server/studio support", "server_wire: speaks a bundled wire protocol with its real client", "integration: tests that require external components", - "graph_export: tests that require GraphML/GraphSON support (the arcadedb-gremlin module)", ] [tool.bandit] diff --git a/bindings/python/scripts/check_test_skips.py b/bindings/python/scripts/check_test_skips.py new file mode 100644 index 00000000000..c4f23a7a711 --- /dev/null +++ b/bindings/python/scripts/check_test_skips.py @@ -0,0 +1,98 @@ +#!/usr/bin/env python3 +"""Fail a test run when a test skipped for a reason nobody has accepted. + +A skip is a test that did not run. When it skips on "the runtime lacks a feature" or on a +missing dependency, a regression or a broken install turns the suite green having exercised +nothing, and a wrong empty answer can show up as a skip. This script reads the JUnit XML that +pytest wrote and exits 1 for every skip whose message is not on the list below. xfail results +are not skips and are not checked here: a strict xfail already fails the suite when it passes. + +usage: check_test_skips.py test-results.xml [--platform linux/amd64] + +Every entry names why the test cannot run on that platform, not why it is inconvenient. +Output is ASCII only: this runs on Windows runners, whose console encoding is not UTF-8. +""" + +from __future__ import annotations + +import argparse +import re +import sys +import xml.etree.ElementTree as ET # nosec B405 - parses the JUnit file pytest just wrote +from typing import Iterable + +# (message pattern, operating systems it is allowed on, why) +ALLOWED_SKIPS = ( + ( + r"^a question mark is not allowed in a Windows file name$", + ("windows",), + "Windows cannot create the file", + ), + ( + r"^the test sends SIGINT to a child process$", + ("windows",), + "Windows has no SIGINT delivery to a child process", + ), + ( + r"^bindings/python/docs is not present on this branch$", + ("linux", "darwin", "windows"), + "the upstream pull request branch has no docs/ directory (the fork's tree always does)", + ), +) + + +def skips(path: str) -> Iterable[tuple[str, str]]: + """Yield (test id, message) for every pytest.skip in the JUnit file.""" + for case in ET.parse(path).getroot().iter("testcase"): # nosec B314 + for child in case: + if child.tag == "skipped" and child.get("type") != "pytest.xfail": + name = f"{case.get('classname')}::{case.get('name')}" + yield name, (child.get("message") or "").strip() + + +def unaccepted(path: str, operating_system: str) -> list[tuple[str, str]]: + bad = [] + for name, message in skips(path): + for pattern, systems, _why in ALLOWED_SKIPS: + if operating_system in systems and re.match(pattern, message): + break + else: + bad.append((name, message)) + return bad + + +def main(argv: list[str] | None = None) -> int: + parser = argparse.ArgumentParser(description=__doc__.split("\n")[0]) + parser.add_argument("junit_xml") + parser.add_argument( + "--platform", + default=sys.platform, + help="matrix platform such as linux/amd64, windows/amd64, darwin/arm64 (default: sys.platform)", + ) + args = parser.parse_args(argv) + head = args.platform.split("/")[0].lower() + operating_system = {"win32": "windows"}.get(head, head) + + bad = unaccepted(args.junit_xml, operating_system) + if not bad: + print(f"OK: every skip is an accepted one ({operating_system})") + return 0 + print(f"ERROR: {len(bad)} test(s) skipped for a reason that is not accepted:") + for name, message in bad: + print(f" {name}: {message[:200]}") + print() + print( + "A skip means the test did not run. Fix the cause (install the package, restore the" + ) + print( + "feature), turn the skip into an assertion, or, if the test truly cannot run on this" + ) + print( + "platform, add its message to ALLOWED_SKIPS in scripts/check_test_skips.py with the" + ) + print("reason in the third field.") + return 1 + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/bindings/python/tests/README.md b/bindings/python/tests/README.md index f404b44d3b7..57c929c6951 100644 --- a/bindings/python/tests/README.md +++ b/bindings/python/tests/README.md @@ -40,12 +40,13 @@ uv run pytest -k "transaction" -v ### A note on the server tests -`test_server.py` and `test_server_patterns.py` skip themselves when server -support is absent, which is convenient but has a failure mode: in 26.7.2 the -server JARs were dropped from the wheel and those tests **skipped instead of -failing**, so the suite stayed green while the feature was gone. That is what -`test_server_packaging.py` is for. It never skips. If you deliberately want a -slim wheel, delete that file on purpose rather than letting the suite go quiet. +`test_server.py` and `test_server_patterns.py` do not skip when the server stack is absent: the +wheel always ships it, and a test that skips on a missing feature cannot notice the feature +going missing (in 26.7.2 the server JARs were dropped from the wheel and the guarded tests +skipped, so the suite stayed green while the feature was gone). `test_server_packaging.py` +states the packaging requirement and fails without the JARs. CI also fails any skip that +`scripts/check_test_skips.py` does not list. If you deliberately want a slim wheel, delete +that file on purpose rather than letting the suite go quiet. ```bash uv run pytest -m server -v # only the server tests diff --git a/bindings/python/tests/conftest.py b/bindings/python/tests/conftest.py index c8a8326d5f0..18444f253ec 100644 --- a/bindings/python/tests/conftest.py +++ b/bindings/python/tests/conftest.py @@ -104,25 +104,6 @@ def temp_server_root(): shutil.rmtree(temp_dir) -def has_server_support(): - """Is the server stack bundled in this wheel? - - The server JARs (arcadedb-server, studio, undertow, xnio, wildfly, jboss, - micrometer) are shipped by default, but a slim build can exclude them via - scripts/jar_exclusions.txt. Probing for the studio JAR keeps the suite - honest either way: server tests skip rather than fail on a slim wheel. - """ - try: - from arcadedb_embedded.jvm import get_jar_path - - jar_dir = get_jar_path() - if not os.path.exists(jar_dir): - return False - return any("studio" in j.lower() for j in os.listdir(jar_dir)) - except Exception: - return False - - @pytest.fixture def temp_db_path(): """Create a temporary database path.""" @@ -217,20 +198,6 @@ def _create_temp_dir(prefix="arcadedb_test_"): shutil.rmtree(temp_dir, ignore_errors=True) -def has_graph_export_support(): - """Check if GraphML/GraphSON export support is available.""" - try: - # GraphML and GraphSON exporters live in the engine's optional - # arcadedb-gremlin module, which the wheel excludes. - from arcadedb_embedded.jvm import get_jar_path - - jar_dir = get_jar_path() - jar_files = os.listdir(jar_dir) if os.path.exists(jar_dir) else [] - return any("arcadedb-gremlin" in jar.lower() for jar in jar_files) - except Exception: - return False - - def pytest_unconfigure(config): """ Prefer graceful JVM shutdown after pytest completes. diff --git a/bindings/python/tests/test_check_test_skips.py b/bindings/python/tests/test_check_test_skips.py new file mode 100644 index 00000000000..d3821830c65 --- /dev/null +++ b/bindings/python/tests/test_check_test_skips.py @@ -0,0 +1,112 @@ +"""The skip gate: a test that skipped for a reason nobody accepted fails the CI job.""" + +from __future__ import annotations + +import importlib.util +from pathlib import Path + +import pytest + +SCRIPT_PATH = Path(__file__).resolve().parents[1] / "scripts" / "check_test_skips.py" + + +def _load(): + spec = importlib.util.spec_from_file_location("check_test_skips", SCRIPT_PATH) + module = importlib.util.module_from_spec(spec) + assert spec.loader is not None + spec.loader.exec_module(module) + return module + + +def _junit(path: Path, skipped: list[tuple[str, str, str]]) -> str: + """A JUnit file with one skipped case per (name, type, message).""" + cases = "".join( + f'' + f'x.py:1: {message}' + for name, kind, message in skipped + ) + path.write_text( + f'' + f'{cases}' + ) + return str(path) + + +def test_a_run_with_no_skips_passes(tmp_path, capsys): + module = _load() + assert ( + module.main([_junit(tmp_path / "r.xml", []), "--platform", "linux/amd64"]) == 0 + ) + assert "OK" in capsys.readouterr().out + + +def test_the_docs_branch_skip_passes_everywhere(tmp_path): + module = _load() + xml = _junit( + tmp_path / "r.xml", + [ + ( + "test_docs_index_and_quickstart_examples", + "pytest.skip", + "bindings/python/docs is not present on this branch", + ) + ], + ) + for platform in ("linux/amd64", "darwin/arm64", "windows/amd64"): + assert module.main([xml, "--platform", platform]) == 0, platform + + +def test_a_windows_only_skip_fails_on_linux(tmp_path, capsys): + module = _load() + xml = _junit( + tmp_path / "r.xml", + [ + ( + "test_sigint", + "pytest.skip", + "the test sends SIGINT to a child process", + ) + ], + ) + assert module.main([xml, "--platform", "windows/amd64"]) == 0 + assert module.main([xml, "--platform", "linux/arm64"]) == 1 + assert "test_sigint" in capsys.readouterr().out + + +@pytest.mark.parametrize( + "message", + [ + "OpenCypher not available", + "Requires GraphML/GraphSON support", + "could not import 'pyarrow': No module named 'pyarrow'", + "Requires server support", + "NumPy not installed", + ], +) +def test_a_skip_for_a_missing_feature_or_package_fails(tmp_path, message, capsys): + module = _load() + xml = _junit(tmp_path / "r.xml", [("test_y", "pytest.skip", message)]) + assert module.main([xml, "--platform", "linux/amd64"]) == 1 + out = capsys.readouterr().out + assert "ERROR" in out and message in out + + +def test_an_xfail_is_not_a_skip(tmp_path): + module = _load() + xml = _junit( + tmp_path / "r.xml", + [("test_known", "pytest.xfail", "ArcadeData/arcadedb#9277: open upstream")], + ) + assert module.main([xml, "--platform", "linux/amd64"]) == 0 + + +def test_the_script_prints_ascii_only(tmp_path, capsys): + module = _load() + xml = _junit( + tmp_path / "r.xml", [("test_y", "pytest.skip", "OpenCypher not available")] + ) + module.main([xml, "--platform", "linux/amd64"]) + module.main([_junit(tmp_path / "ok.xml", []), "--platform", "linux/amd64"]) + out = capsys.readouterr().out + out.encode("ascii") + assert SCRIPT_PATH.read_text(encoding="utf-8").isascii() diff --git a/bindings/python/tests/test_columnar_readers.py b/bindings/python/tests/test_columnar_readers.py index cf81d59228c..968256c9f0e 100644 --- a/bindings/python/tests/test_columnar_readers.py +++ b/bindings/python/tests/test_columnar_readers.py @@ -15,8 +15,8 @@ import arcadedb_embedded as arcadedb import pytest -pa = pytest.importorskip("pyarrow", reason="to_arrow() requires pyarrow") -pd = pytest.importorskip("pandas", reason="to_dataframe() requires pandas") +pa = pytest.importorskip("pyarrow") +pd = pytest.importorskip("pandas") BATCH_SIZES = [25_000, 2, 1] diff --git a/bindings/python/tests/test_core.py b/bindings/python/tests/test_core.py index bee5e5d7dae..d23d9f91fbe 100644 --- a/bindings/python/tests/test_core.py +++ b/bindings/python/tests/test_core.py @@ -620,26 +620,21 @@ def test_opencypher_queries(temp_db_path): db.command("sql", "CREATE VERTEX TYPE Person") db.command("sql", "CREATE EDGE TYPE FRIEND_OF") - # Insert data using OpenCypher (if available) - try: - with db.transaction(): - db.command("opencypher", "CREATE (p:Person {name: 'Alice', age: 30})") - db.command("opencypher", "CREATE (p:Person {name: 'Bob', age: 25})") + # Insert data using OpenCypher + with db.transaction(): + db.command("opencypher", "CREATE (p:Person {name: 'Alice', age: 30})") + db.command("opencypher", "CREATE (p:Person {name: 'Bob', age: 25})") - # Query using OpenCypher - result = db.query( - "opencypher", - "MATCH (p:Person) WHERE p.age > 20 RETURN p.name as name", - ) - names = [record.get("name") for record in result] - - assert len(names) == 2 - assert "Alice" in names - assert "Bob" in names - except arcadedb.ArcadeDBError as e: - if "Query engine 'opencypher' was not found" in str(e): - pytest.skip("OpenCypher not available (unexpected in base package)") - raise + # Query using OpenCypher + result = db.query( + "opencypher", + "MATCH (p:Person) WHERE p.age > 20 RETURN p.name as name", + ) + names = [record.get("name") for record in result] + + assert len(names) == 2 + assert "Alice" in names + assert "Bob" in names def test_unicode_support(temp_db_path): diff --git a/bindings/python/tests/test_cypher.py b/bindings/python/tests/test_cypher.py index e65ab64a828..c255ccf15e7 100644 --- a/bindings/python/tests/test_cypher.py +++ b/bindings/python/tests/test_cypher.py @@ -5,12 +5,7 @@ def _ensure_opencypher(db) -> None: - try: - _ = list(db.query("opencypher", "RETURN 1 AS one")) - except arcadedb.ArcadeDBError as e: - if "Query engine 'opencypher' was not found" in str(e): - pytest.skip("OpenCypher not available") - raise + _ = list(db.query("opencypher", "RETURN 1 AS one")) def _seed_graph(db) -> None: @@ -267,12 +262,7 @@ def test_opencypher_case_and_coalesce(temp_db_path): "ELSE coalesce(c.name,'n/a') END AS status " "ORDER BY name", ) - try: - rows = [(record.get("name"), record.get("status")) for record in result] - except Exception as e: - if "StatelessFunction" in str(e): - pytest.skip("OpenCypher CASE/coalesce not supported") - raise + rows = [(record.get("name"), record.get("status")) for record in result] assert rows == [ ("Alice", "Acme"), @@ -313,9 +303,6 @@ def test_opencypher_collect_and_unwind(temp_db_path): ) rows = [(record.get("company"), record.get("employee")) for record in result] - if not rows: - pytest.skip("OpenCypher collect/UNWIND not supported") - assert rows == [("Acme", "Alice"), ("Acme", "Bob")] @@ -351,9 +338,7 @@ def test_opencypher_pattern_comprehension(temp_db_path): row = next(result) years = row.get("since_years") - if years is None: - pytest.skip("OpenCypher pattern comprehension not supported") - + assert years is not None assert sorted(list(years)) == [2020] diff --git a/bindings/python/tests/test_docs_examples.py b/bindings/python/tests/test_docs_examples.py index a90b9a68ea6..37d69b6114e 100644 --- a/bindings/python/tests/test_docs_examples.py +++ b/bindings/python/tests/test_docs_examples.py @@ -7,7 +7,6 @@ from pathlib import Path import pytest -from tests.conftest import has_server_support DOCS_ROOT = Path(__file__).resolve().parents[1] / "docs" PYTHON_BLOCK_RE = re.compile(r"```python\n(.*?)```", re.DOTALL) @@ -372,7 +371,6 @@ def test_docs_index_and_quickstart_examples(temp_dir_factory): @pytest.mark.server -@pytest.mark.skipif(not has_server_support(), reason="Requires server support") def test_docs_api_access_examples(temp_dir_factory): """Every access path documented in api-access-methods.md actually runs. diff --git a/bindings/python/tests/test_exporter.py b/bindings/python/tests/test_exporter.py index 560daef2731..eb5c097a643 100644 --- a/bindings/python/tests/test_exporter.py +++ b/bindings/python/tests/test_exporter.py @@ -1,6 +1,6 @@ """ Tests for ArcadeDB database export functionality. -Tests JSONL, GraphML, GraphSON, and CSV export capabilities. +Tests JSONL and CSV export, and the error GraphML and GraphSON raise (the wheel has no gremlin). """ import csv @@ -10,7 +10,6 @@ import arcadedb_embedded as arcadedb import pytest -from tests.conftest import has_graph_export_support @pytest.fixture @@ -295,69 +294,6 @@ def test_export_invalid_format(self, sample_db, temp_db_path): or "format" in str(exc_info.value).lower() ) - @pytest.mark.graph_export - @pytest.mark.skipif( - not has_graph_export_support(), reason="Requires GraphML/GraphSON support" - ) - def test_export_graphml(self, sample_db, temp_db_path): - """Test GraphML export (requires GraphML/GraphSON support).""" - export_path = "test_export.graphml.tgz" - - try: - stats = sample_db.export_database( - export_path, format="graphml", overwrite=True - ) - - # Check statistics - GraphML may only export graph elements - assert "elapsedInSecs" in stats - # GraphML format exists and file was created - - # Check file exists - export_file = Path("exports") / export_path - assert export_file.exists() - - # Clean up - export_file.unlink() - - except arcadedb.ArcadeDBError as e: - if "requires additional modules" in str(e): - pytest.skip("GraphML export requires GraphML/GraphSON support") - else: - raise - - @pytest.mark.graph_export - @pytest.mark.skipif( - not has_graph_export_support(), reason="Requires GraphML/GraphSON support" - ) - def test_export_graphson(self, sample_db, temp_db_path): - """Test GraphSON export (requires GraphML/GraphSON support).""" - export_path = "test_export.graphson.tgz" - - try: - stats = sample_db.export_database( - export_path, format="graphson", overwrite=True - ) - - # Check statistics - GraphSON may only export graph elements - assert "elapsedInSecs" in stats - # GraphSON format exists and file was created - - # Check file exists - export_file = Path("exports") / export_path - assert export_file.exists() - - # Clean up - export_file.unlink() - - except arcadedb.ArcadeDBError as e: - if "requires additional modules" in str(e): - pytest.skip("GraphSON export requires GraphML/GraphSON support") - else: - raise - - @pytest.mark.skipif( - has_graph_export_support(), reason="arcadedb-gremlin is on the classpath" - ) @pytest.mark.parametrize("fmt", ["graphml", "graphson"]) def test_graph_formats_without_gremlin_raise_and_name_jsonl( self, sample_db, temp_db_path, fmt diff --git a/bindings/python/tests/test_geo_predicate_sql.py b/bindings/python/tests/test_geo_predicate_sql.py index df75c730b19..91921073e3b 100644 --- a/bindings/python/tests/test_geo_predicate_sql.py +++ b/bindings/python/tests/test_geo_predicate_sql.py @@ -1,25 +1,17 @@ """Geo predicate SQL coverage for Python bindings.""" import arcadedb_embedded as arcadedb -import pytest def test_geo_predicate_sql_within_and_intersects(temp_db_path): """Validate geo.within and geo.intersects boolean semantics through SQL.""" with arcadedb.create_database(temp_db_path) as db: - try: - within_inside = next( - db.query( - "sql", - "select geo.within('POINT (5 5)', 'POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))') as v", - ) + within_inside = next( + db.query( + "sql", + "select geo.within('POINT (5 5)', 'POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))') as v", ) - except Exception as e: - if "Unknown method name: within" in str(e): - pytest.skip( - "Geo SQL functions are not available in this packaged runtime" - ) - raise + ) within_outside = next( db.query( "sql", @@ -55,19 +47,12 @@ def test_geo_predicate_sql_within_and_intersects(temp_db_path): def test_geo_predicate_sql_boundary_and_repeatability(temp_db_path): """Geo predicates should remain stable across repeated calls and boundary points.""" with arcadedb.create_database(temp_db_path) as db: - try: - boundary = next( - db.query( - "sql", - "select geo.within('POINT (0 0)', 'POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))') as v", - ) + boundary = next( + db.query( + "sql", + "select geo.within('POINT (0 0)', 'POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))') as v", ) - except Exception as e: - if "Unknown method name: within" in str(e): - pytest.skip( - "Geo SQL functions are not available in this packaged runtime" - ) - raise + ) inside_first = next( db.query( diff --git a/bindings/python/tests/test_graph_algorithms_sql.py b/bindings/python/tests/test_graph_algorithms_sql.py index 9c203da0d18..bf5fbab509d 100644 --- a/bindings/python/tests/test_graph_algorithms_sql.py +++ b/bindings/python/tests/test_graph_algorithms_sql.py @@ -1,13 +1,6 @@ """Graph algorithm SQL coverage for Python bindings.""" import arcadedb_embedded as arcadedb -import pytest - -_GRAPH_ALGO_UNAVAILABLE_TOKENS = ( - "Unknown method name: shortestPath", - "Unknown method name: dijkstra", - "Unknown method name: astar", -) def _setup_weighted_graph(db): @@ -34,31 +27,23 @@ def _setup_weighted_graph(db): } -def _path_query_or_skip(db, select_statement): +def _path_query(db, select_statement): script = f""" LET $src = (SELECT FROM Node WHERE name = 'A' LIMIT 1); LET $dst = (SELECT FROM Node WHERE name = 'D' LIMIT 1); {select_statement} """ # nosec B608 - try: - result = db.command("sqlscript", script) - path = None - for row in result: - if "path" in row.property_names: - path = row.get("path") + result = db.command("sqlscript", script) + path = None + for row in result: + if "path" in row.property_names: + path = row.get("path") - if path is None: - raise AssertionError("Graph algorithm query did not return a 'path' column") + if path is None: + raise AssertionError("Graph algorithm query did not return a 'path' column") - return path - except Exception as e: - message = str(e) - if any(token in message for token in _GRAPH_ALGO_UNAVAILABLE_TOKENS): - pytest.skip( - "Graph algorithm SQL functions are not available in this packaged runtime" - ) - raise + return path def test_graph_shortest_path_sql_unweighted_path_shape(temp_db_path): @@ -66,7 +51,7 @@ def test_graph_shortest_path_sql_unweighted_path_shape(temp_db_path): with arcadedb.create_database(temp_db_path) as db: rids = _setup_weighted_graph(db) - path = _path_query_or_skip( + path = _path_query( db, "SELECT shortestPath($src.@rid, $dst.@rid) AS path FROM Node LIMIT 1", ) @@ -82,7 +67,7 @@ def test_graph_dijkstra_sql_weighted_path_shape(temp_db_path): with arcadedb.create_database(temp_db_path) as db: rids = _setup_weighted_graph(db) - path = _path_query_or_skip( + path = _path_query( db, "SELECT dijkstra($src, $dst, 'distance') AS path FROM Node LIMIT 1", ) @@ -97,7 +82,7 @@ def test_graph_astar_sql_weighted_path_shape(temp_db_path): with arcadedb.create_database(temp_db_path) as db: rids = _setup_weighted_graph(db) - path = _path_query_or_skip( + path = _path_query( db, "SELECT astar($src, $dst, 'distance') AS path FROM Node LIMIT 1", ) @@ -112,7 +97,7 @@ def test_graph_dijkstra_sql_accepts_rid_variables(temp_db_path): with arcadedb.create_database(temp_db_path) as db: rids = _setup_weighted_graph(db) - path = _path_query_or_skip( + path = _path_query( db, "SELECT dijkstra($src.@rid, $dst.@rid, 'distance') AS path FROM Node LIMIT 1", ) @@ -132,7 +117,7 @@ def test_graph_shortest_path_sql_no_path_returns_empty_or_null(temp_db_path): db.new_vertex("Node").set("name", "X").save() db.new_vertex("Node").set("name", "Y").save() - path = _path_query_or_skip( + path = _path_query( db, "SELECT shortestPath((SELECT FROM Node WHERE name='X' LIMIT 1), (SELECT FROM Node WHERE name='Y' LIMIT 1)) AS path FROM Node LIMIT 1", ) diff --git a/bindings/python/tests/test_hash_index_schema.py b/bindings/python/tests/test_hash_index_schema.py index 5b6606adf1a..21a40beb4c4 100644 --- a/bindings/python/tests/test_hash_index_schema.py +++ b/bindings/python/tests/test_hash_index_schema.py @@ -16,17 +16,12 @@ def test_hash_index_schema_create_discover_and_query(temp_db_path): db.command("sql", "INSERT INTO Product SET sku = 'A-002', price = 20") db.command("sql", "INSERT INTO Product SET sku = 'A-003', price = 30") - try: - created_index = schema.create_index( - "Product", - ["sku"], - unique=False, - index_type=arcadedb.IndexType.HASH, - ) - except arcadedb.ArcadeDBError as e: - if "Invalid index type 'HASH'" in str(e): - pytest.skip("HASH index type is not available in this packaged runtime") - raise + created_index = schema.create_index( + "Product", + ["sku"], + unique=False, + index_type=arcadedb.IndexType.HASH, + ) assert created_index is not None indexes = schema.get_indexes() @@ -55,23 +50,18 @@ def test_hash_index_schema_get_or_create_and_force_drop(temp_db_path): schema.create_document_type("Inventory") schema.create_property("Inventory", "code", arcadedb.PropertyType.STRING) - try: - idx1 = schema.get_or_create_index( - "Inventory", - ["code"], - unique=False, - index_type=arcadedb.IndexType.HASH, - ) - idx2 = schema.get_or_create_index( - "Inventory", - ["code"], - unique=False, - index_type=arcadedb.IndexType.HASH, - ) - except arcadedb.ArcadeDBError as e: - if "Invalid index type 'HASH'" in str(e): - pytest.skip("HASH index type is not available in this packaged runtime") - raise + idx1 = schema.get_or_create_index( + "Inventory", + ["code"], + unique=False, + index_type=arcadedb.IndexType.HASH, + ) + idx2 = schema.get_or_create_index( + "Inventory", + ["code"], + unique=False, + index_type=arcadedb.IndexType.HASH, + ) assert idx1 is not None assert idx2 is not None diff --git a/bindings/python/tests/test_import_database.py b/bindings/python/tests/test_import_database.py index 7a1abb2f01a..6625420a4db 100644 --- a/bindings/python/tests/test_import_database.py +++ b/bindings/python/tests/test_import_database.py @@ -80,17 +80,6 @@ def _import_result_ok(result_set): return row -def _exception_chain_text(exc: BaseException) -> str: - parts = [] - current = exc - seen = set() - while current is not None and id(current) not in seen: - seen.add(id(current)) - parts.append(str(current)) - current = current.__cause__ or current.__context__ - return "\n".join(parts).lower() - - def test_import_database_csv_documents(temp_db_path, sample_csv_path): with arcadedb.create_database(temp_db_path) as db: result = db.command("sql", f"IMPORT DATABASE {_file_url(sample_csv_path)}") @@ -123,8 +112,7 @@ def test_import_database_csv_documents_with_quoted_parallel_setting( def test_import_database_csv_graph_vertices_and_edges(temp_db_path): vertices_csv = _resource_path("importer-vertices.csv") edges_csv = _resource_path("importer-edges.csv") - if not vertices_csv.exists() or not edges_csv.exists(): - pytest.skip("Graph CSV fixtures not available") + assert vertices_csv.exists() and edges_csv.exists() with arcadedb.create_database(temp_db_path) as db: v_res = db.command( @@ -169,8 +157,7 @@ def test_import_database_csv_graph_vertices_and_edges_with_quoted_parallel( ): vertices_csv = _resource_path("importer-vertices.csv") edges_csv = _resource_path("importer-edges.csv") - if not vertices_csv.exists() or not edges_csv.exists(): - pytest.skip("Graph CSV fixtures not available") + assert vertices_csv.exists() and edges_csv.exists() with arcadedb.create_database(temp_db_path) as db: result = db.command( @@ -203,29 +190,13 @@ def test_import_database_csv_graph_vertices_and_edges_with_quoted_parallel( def test_import_database_xml_vertices(temp_db_path, sample_xml_path): with arcadedb.create_database(temp_db_path) as db: - try: - result = db.command( - "sql", - ( - f"IMPORT DATABASE {_file_url(sample_xml_path)} " - "WITH objectNestLevel = 1, entityType = 'VERTEX'" - ), - ) - except arcadedb.ArcadeDBError as e: - message = _exception_chain_text(e) - if os.name == "nt" and ( - "arrayindexoutofboundsexception" in message - or "index 1 out of bounds for length 1" in message - or ( - "error on importing database" in message - and "error on parsing source" in message - ) - ): - pytest.skip( - "XML import path currently fails on Windows runtime " - f"(engine-side): {e}" - ) - raise + result = db.command( + "sql", + ( + f"IMPORT DATABASE {_file_url(sample_xml_path)} " + "WITH objectNestLevel = 1, entityType = 'VERTEX'" + ), + ) _import_result_ok(result) count = db.query("sql", "SELECT count(*) as c FROM v_user").one().get("c") @@ -234,23 +205,17 @@ def test_import_database_xml_vertices(temp_db_path, sample_xml_path): def test_import_database_neo4j_fixture(temp_db_path): neo4j_file = _resource_path("neo4j-export-mini.jsonl") - if not neo4j_file.exists(): - pytest.skip("Neo4j fixture not available") + assert neo4j_file.exists() with arcadedb.create_database(temp_db_path) as db: - try: - result = db.command( - "sql", - ( - "IMPORT DATABASE WITH " - f"documents = '{_file_url(str(neo4j_file))}', " - "documentsFileType = 'neo4j'" - ), - ) - except arcadedb.ArcadeDBError as e: - if "neo4j" in str(e).lower() or "unknown" in str(e).lower(): - pytest.skip(f"Neo4j import not available in current runtime: {e}") - raise + result = db.command( + "sql", + ( + "IMPORT DATABASE WITH " + f"documents = '{_file_url(str(neo4j_file))}', " + "documentsFileType = 'neo4j'" + ), + ) _import_result_ok(result) # Neo4j import should create at least one type @@ -259,27 +224,21 @@ def test_import_database_neo4j_fixture(temp_db_path): def test_import_database_word2vec_vectors(temp_db_path): word2vec_file = _resource_path("importer-word2vec.txt") - if not word2vec_file.exists(): - pytest.skip("Word2Vec fixture not available") + assert word2vec_file.exists() with arcadedb.create_database(temp_db_path) as db: - try: - result = db.command( - "sql", - ( - f"IMPORT DATABASE {_file_url(str(word2vec_file))} WITH " - "distanceFunction = cosine, " - "m = 16, " - "beamWidth = 100, " - "vertexType = Word, " - "vectorProperty = vector, " - "idProperty = name" - ), - ) - except arcadedb.ArcadeDBError as e: - if "vector" in str(e).lower() or "word2vec" in str(e).lower(): - pytest.skip(f"Vector import not available in current runtime: {e}") - raise + result = db.command( + "sql", + ( + f"IMPORT DATABASE {_file_url(str(word2vec_file))} WITH " + "distanceFunction = cosine, " + "m = 16, " + "beamWidth = 100, " + "vertexType = Word, " + "vectorProperty = vector, " + "idProperty = name" + ), + ) _import_result_ok(result) count = db.query("sql", "SELECT count(*) as c FROM Word").one().get("c") @@ -288,30 +247,10 @@ def test_import_database_word2vec_vectors(temp_db_path): def test_import_database_rdf_fixture(temp_db_path): rdf_source = _resource_path("importer-rdf.xml") - if not rdf_source.exists(): - pytest.skip("RDF fixture not available") + assert rdf_source.exists() with arcadedb.create_database(temp_db_path) as db: - try: - result = db.command("sql", f"IMPORT DATABASE {_file_url(str(rdf_source))}") - except arcadedb.ArcadeDBError as e: - message = _exception_chain_text(e) - if "rdf" in message or "cannot determine the file type" in message: - pytest.skip(f"RDF import not available in current runtime: {e}") - if os.name == "nt" and ( - "arrayindexoutofboundsexception" in message - or "index 1 out of bounds for length 1" in message - or ( - "error on importing database" in message - and "error on parsing source" in message - ) - ): - pytest.skip( - "RDF import path currently fails on Windows runtime " - f"(engine-side): {e}" - ) - raise - + result = db.command("sql", f"IMPORT DATABASE {_file_url(str(rdf_source))}") _import_result_ok(result) # RDF import should create at least one imported record/type. @@ -323,15 +262,10 @@ def test_import_database_rdf_fixture(temp_db_path): def test_import_database_into_timeseries_type(temp_db_path, sample_timeseries_csv_path): with arcadedb.create_database(temp_db_path) as db: - try: - db.command( - "sql", - "CREATE TIMESERIES TYPE Telemetry TIMESTAMP ts TAGS (id INTEGER) FIELDS (value DOUBLE)", - ) - except arcadedb.ArcadeDBError as e: - if "timeseries" in str(e).lower() or "syntax" in str(e).lower(): - pytest.skip(f"Timeseries not available in current runtime: {e}") - raise + db.command( + "sql", + "CREATE TIMESERIES TYPE Telemetry TIMESTAMP ts TAGS (id INTEGER) FIELDS (value DOUBLE)", + ) # IMPORT DATABASE cannot target a TIMESERIES type, and this asserts that # rather than skipping past it. diff --git a/bindings/python/tests/test_jvm_args.py b/bindings/python/tests/test_jvm_args.py index 61bcdbf8121..570fa76bcc6 100644 --- a/bindings/python/tests/test_jvm_args.py +++ b/bindings/python/tests/test_jvm_args.py @@ -187,15 +187,41 @@ def test_conftest_binds_each_pytest_hook_once(): assert [n for n, c in names.items() if c > 1] == [] -def test_faulthandler_is_off_on_windows(): +def test_faulthandler_is_off_on_windows_only(): + # The conftest hook is a function of sys.platform, so every platform can check it for all + # three. It runs in a child process: calling faulthandler.enable() or disable() in the test + # process after the JVM started replaces HotSpot's SIGSEGV handler (the JVM raises SIGSEGV + # on purpose for safepoints and implicit null checks), and the next one kills the run with + # exit 139 and no hs_err file. On Windows the session's real state is read as well. import faulthandler + import subprocess # nosec B404 - test-controlled child process import sys + from pathlib import Path - import pytest + code = """ +import faulthandler, sys +sys.path.insert(0, sys.argv[1]) +from tests import conftest + +for platform, expect_enabled in (("win32", False), ("linux", True), ("darwin", True)): + faulthandler.enable() + sys.platform = platform + conftest.pytest_configure(None) + assert faulthandler.is_enabled() is expect_enabled, platform +print("ok") +""" + root = str(Path(__file__).resolve().parents[1]) + result = subprocess.run( # nosec B603 - fixed argument list, no shell + [sys.executable, "-c", code, root], + capture_output=True, + text=True, + timeout=60, + ) + assert result.returncode == 0, result.stderr + assert result.stdout.strip() == "ok" - if sys.platform != "win32": - pytest.skip("the conftest hook disables it on Windows only") - assert not faulthandler.is_enabled() + if sys.platform == "win32": + assert not faulthandler.is_enabled() def test_java_thread_dump_lists_the_jvm_threads(temp_db): diff --git a/bindings/python/tests/test_jvm_payload.py b/bindings/python/tests/test_jvm_payload.py index 77a2b075d56..0989e3025f8 100644 --- a/bindings/python/tests/test_jvm_payload.py +++ b/bindings/python/tests/test_jvm_payload.py @@ -20,26 +20,21 @@ import os import sys -import pytest - _REPO = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..", "..")) _CHECK_DIR = os.path.join(_REPO, "benchmarks", "experiments") def _load(): - """Import the checker, or skip when the benchmark tree is not checked out. + """Import the checker from benchmarks/experiments. - The bindings are distributed without benchmarks/, so a user running the - suite from an sdist must not see a failure for a file they do not have. + This file stays in the fork (make-upstream-pr-branch.sh excludes it), and the + fork's checkout always has benchmarks/, so a missing checker is a failure. """ - if not os.path.isdir(_CHECK_DIR): - pytest.skip("benchmarks/experiments is not checked out") + assert os.path.isdir(_CHECK_DIR), f"{_CHECK_DIR} is not checked out" if _CHECK_DIR not in sys.path: sys.path.insert(0, _CHECK_DIR) - try: - import jvm_payload_check - except ImportError: # pragma: no cover - pytest.skip("jvm_payload_check.py is not present") + import jvm_payload_check + return jvm_payload_check diff --git a/bindings/python/tests/test_numpy_support.py b/bindings/python/tests/test_numpy_support.py index 0d9591d02cd..350173a35eb 100644 --- a/bindings/python/tests/test_numpy_support.py +++ b/bindings/python/tests/test_numpy_support.py @@ -5,15 +5,9 @@ import arcadedb_embedded as arcadedb import pytest -try: - import numpy as np +np = pytest.importorskip("numpy") - HAS_NUMPY = True -except ImportError: - HAS_NUMPY = False - -@pytest.mark.skipif(not HAS_NUMPY, reason="NumPy not installed") def test_numpy_array_conversion_in_command(temp_db): """Test automatic conversion of NumPy arrays in db.command().""" db = temp_db @@ -39,7 +33,6 @@ def test_numpy_array_conversion_in_command(temp_db): assert abs(stored_vec[2] - 0.3) < 0.0001 -@pytest.mark.skipif(not HAS_NUMPY, reason="NumPy not installed") def test_numpy_array_conversion_in_query(temp_db): """Test automatic conversion of NumPy arrays in db.query().""" db = temp_db @@ -68,7 +61,6 @@ def test_numpy_array_conversion_in_query(temp_db): pytest.fail(f"Query with NumPy array failed: {e}") -@pytest.mark.skipif(not HAS_NUMPY, reason="NumPy not installed") def test_numpy_array_conversion_in_transaction(temp_db): """Test NumPy array conversion in regular transactions (no batch context).""" db = temp_db diff --git a/bindings/python/tests/test_resultset_arrow.py b/bindings/python/tests/test_resultset_arrow.py index 7cddce44549..2d7f6c15834 100644 --- a/bindings/python/tests/test_resultset_arrow.py +++ b/bindings/python/tests/test_resultset_arrow.py @@ -13,7 +13,7 @@ import arcadedb_embedded as arcadedb import pytest -pa = pytest.importorskip("pyarrow", reason="to_arrow() requires pyarrow") +pa = pytest.importorskip("pyarrow") def test_to_arrow_basic_types(temp_db_path): diff --git a/bindings/python/tests/test_server.py b/bindings/python/tests/test_server.py index 842387e276f..f6ad64f11e3 100644 --- a/bindings/python/tests/test_server.py +++ b/bindings/python/tests/test_server.py @@ -16,11 +16,10 @@ import pytest from arcadedb_embedded import ArcadeDBServer -from tests.conftest import TEST_PASSWORD, has_server_support +from tests.conftest import TEST_PASSWORD @pytest.mark.server -@pytest.mark.skipif(not has_server_support(), reason="Requires server support") def test_server_creation(temp_server_root): """Test creating and starting a server.""" server = ArcadeDBServer( @@ -46,7 +45,6 @@ def test_server_creation(temp_server_root): @pytest.mark.server -@pytest.mark.skipif(not has_server_support(), reason="Requires server support") def test_server_database_operations(temp_server_root): """ Test database operations through server using Java API. @@ -84,7 +82,6 @@ def test_server_database_operations(temp_server_root): @pytest.mark.server -@pytest.mark.skipif(not has_server_support(), reason="Requires server support") def test_server_custom_config(temp_server_root): """Test server with custom configuration.""" config = {"http_port": 8080, "host": "127.0.0.1", "mode": "production"} @@ -101,7 +98,6 @@ def test_server_custom_config(temp_server_root): @pytest.mark.server -@pytest.mark.skipif(not has_server_support(), reason="Requires server support") def test_server_context_manager(temp_server_root): """Test server context manager.""" with ArcadeDBServer( @@ -136,7 +132,6 @@ def test_default_host_is_localhost(temp_server_root): @pytest.mark.server -@pytest.mark.skipif(not has_server_support(), reason="Requires server support") def test_failed_server_start_does_not_hang_process_exit(tmp_path): """A server.start() that fails part-way must not leave the process unable to exit. diff --git a/bindings/python/tests/test_server_packaging.py b/bindings/python/tests/test_server_packaging.py index eb3a1f67a0b..d1e0dabe71a 100644 --- a/bindings/python/tests/test_server_packaging.py +++ b/bindings/python/tests/test_server_packaging.py @@ -3,12 +3,13 @@ This file exists because of a specific failure. On 2026-07-05 commit cfcde0c2 excluded the server JARs and deleted ``server.py`` to save ~7 MB, that shipped in stable 26.7.2 on 2026-07-09, and nobody noticed for three weeks until a -downstream user said so on the commit itself. Every other server test in this -suite is guarded by ``has_server_support()``, so when the JARs vanished those -tests did not fail. **They skipped, silently, and the suite stayed green.** +downstream user said so on the commit itself. The other server tests were +guarded by a helper that skipped them when the JARs were missing, so they did +not fail: **they skipped, silently, and the suite stayed green.** That guard is +gone, and CI now fails any skip it does not list (scripts/check_test_skips.py), +so a wheel without the server stack fails the server tests as well as these. -A guard that skips when the thing it guards is missing cannot detect the thing -going missing. So these tests deliberately do NOT skip: if the server stack is +These tests state the packaging requirement directly: if the server stack is absent, they fail. If a future build genuinely wants a slim wheel, that is a decision to make on @@ -54,8 +55,8 @@ def test_server_jars_are_bundled(): assert not missing, ( f"server JARs missing from the wheel: {missing}\n" f"This is how server mode was lost in 26.7.2. If the removal is " - f"deliberate, delete this test explicitly rather than leaving the " - f"server tests to skip themselves into a green suite.\n" + f"deliberate, delete this test explicitly rather than letting the " + f"suite go quiet.\n" f"jars present: {names}" ) @@ -75,25 +76,6 @@ def test_server_api_is_importable_and_exported(): assert "create_server" in adb.__all__, "create_server missing from __all__" -def test_has_server_support_agrees_with_reality(): - """The skip-guard other server tests rely on must not lie. - - If ``has_server_support()`` returned False while the JARs are present, - every server test would skip and the suite would look fine while covering - nothing. That is precisely the failure mode this file exists to close, so - the guard itself is checked against the JARs it claims to detect. - """ - from tests.conftest import has_server_support - - names = _jar_names() - jars_present = any(n.startswith("arcadedb-studio") for n in names) - assert has_server_support() == jars_present, ( - f"has_server_support() returned {has_server_support()} but studio JAR " - f"present={jars_present}. The guard and the wheel disagree, so server " - f"tests are skipping or running for the wrong reason." - ) - - def test_studio_jar_carries_no_classes(): """Studio is static assets only, which is why bundling it is cheap. diff --git a/bindings/python/tests/test_server_patterns.py b/bindings/python/tests/test_server_patterns.py index b47df3f57a4..09e4bffd0a9 100644 --- a/bindings/python/tests/test_server_patterns.py +++ b/bindings/python/tests/test_server_patterns.py @@ -531,11 +531,8 @@ def test_http_api_access_pattern(cleanup_test_dirs): print("=" * 70) # Import requests here to avoid dependency for non-HTTP tests - try: - import requests - from requests.auth import HTTPBasicAuth - except ImportError: - pytest.skip("requests library not available for HTTP API testing") + requests = pytest.importorskip("requests") + from requests.auth import HTTPBasicAuth root_path = create_temp_dir("http_api_") diff --git a/bindings/python/tests/test_timeseries_sql.py b/bindings/python/tests/test_timeseries_sql.py index 53b53781b6b..20ca333500a 100644 --- a/bindings/python/tests/test_timeseries_sql.py +++ b/bindings/python/tests/test_timeseries_sql.py @@ -3,19 +3,13 @@ from datetime import datetime, timezone import arcadedb_embedded as arcadedb -import pytest -def _create_timeseries_or_skip(db): - try: - db.command( - "sql", - "CREATE TIMESERIES TYPE TempData TIMESTAMP ts TAGS (sensor_id STRING) FIELDS (value DOUBLE)", - ) - except arcadedb.ArcadeDBError as e: - if "CREATE TIMESERIES" in str(e) or "no viable alternative" in str(e): - pytest.skip("TIMESERIES SQL is not available in this packaged runtime") - raise +def _create_timeseries(db): + db.command( + "sql", + "CREATE TIMESERIES TYPE TempData TIMESTAMP ts TAGS (sensor_id STRING) FIELDS (value DOUBLE)", + ) def _to_epoch_millis(value): @@ -44,7 +38,7 @@ def _assert_epoch_set(actual_values, expected_values): def test_timeseries_sql_insert_between_and_bucket(temp_db_path): """Create timeseries type, insert records, query by range, and aggregate by bucket.""" with arcadedb.create_database(temp_db_path) as db: - _create_timeseries_or_skip(db) + _create_timeseries(db) with db.transaction(): db.command( @@ -92,7 +86,7 @@ def test_timeseries_sql_insert_between_and_bucket(temp_db_path): def test_timeseries_sql_tag_filter_and_empty_range(temp_db_path): """Timeseries supports tag filtering and returns no rows for non-overlapping ranges.""" with arcadedb.create_database(temp_db_path) as db: - _create_timeseries_or_skip(db) + _create_timeseries(db) with db.transaction(): db.command( @@ -128,7 +122,7 @@ def test_compact_timeseries_type_seals_the_tail(temp_db_path): import numpy as np with arcadedb.create_database(temp_db_path) as db: - _create_timeseries_or_skip(db) + _create_timeseries(db) n = 5_000 ex = db.async_executor() ex.append_samples( diff --git a/bindings/python/tests/test_vector.py b/bindings/python/tests/test_vector.py index 6d4a8d9ac3a..c1d96ceb3d4 100644 --- a/bindings/python/tests/test_vector.py +++ b/bindings/python/tests/test_vector.py @@ -436,8 +436,7 @@ def test_lsm_vector_search_approximate_typeindex(self, test_db): pq_clusters=2, ) - if "TypeIndex" not in index._java_index.getClass().getName(): - pytest.skip("TypeIndex wrapper not returned by this build") + assert "TypeIndex" in index._java_index.getClass().getName() vectors = [ [1.0, 0.0, 0.0], @@ -1424,10 +1423,7 @@ def test_lsm_cosine_distance_3d_parallel_and_opposite(self, test_db): def test_lsm_cosine_distance_high_dimensional(self, test_db): """Test cosine distance in high dimensions (128D).""" - try: - import numpy as np - except ImportError: - pytest.skip("NumPy required for high-dimensional test") + np = pytest.importorskip("numpy") test_db.command("sql", "CREATE VERTEX TYPE VectorTestHD") test_db.command("sql", "CREATE PROPERTY VectorTestHD.name STRING") diff --git a/bindings/python/tests/test_vector_params_verification.py b/bindings/python/tests/test_vector_params_verification.py index fa681fa7243..3e36c390abd 100644 --- a/bindings/python/tests/test_vector_params_verification.py +++ b/bindings/python/tests/test_vector_params_verification.py @@ -103,24 +103,15 @@ def test_encoding_param(self, test_db): test_db.command("sql", "CREATE VERTEX TYPE EncodingDoc") test_db.command("sql", "CREATE PROPERTY EncodingDoc.embedding BINARY") - try: - index = test_db.create_vector_index( - "EncodingDoc", - "embedding", - dimensions=4, - quantization="NONE", - encoding="INT8", - ) - except arcadedb.ArcadeDBError as exc: - if "does not support vector encoding" in str(exc): - pytest.skip("Current embedded engine build does not support encoding") - raise + index = test_db.create_vector_index( + "EncodingDoc", + "embedding", + dimensions=4, + quantization="NONE", + encoding="INT8", + ) metadata = self._get_primary_metadata(index) - if not hasattr(metadata, "encoding"): - pytest.skip( - "Current embedded engine build does not expose encoding metadata" - ) assert str(metadata.encoding) == "INT8" assert str(metadata.quantizationType) == "NONE" diff --git a/bindings/python/tests/test_vector_sql.py b/bindings/python/tests/test_vector_sql.py index 93d75c21cb2..4ad429eaebd 100644 --- a/bindings/python/tests/test_vector_sql.py +++ b/bindings/python/tests/test_vector_sql.py @@ -464,10 +464,6 @@ def test_create_index_with_native_int8_encoding_sql(self, test_db): metadata = self._get_primary_sql_vector_index( test_db, "SqlNativeInt8Doc[vec]" ).getMetadata() - if not hasattr(metadata, "encoding"): - pytest.skip( - "Current embedded engine build does not expose encoding metadata" - ) assert str(metadata.encoding) == "INT8" assert str(metadata.quantizationType) == "NONE" @@ -490,33 +486,25 @@ def test_vector_neighbors_on_native_int8_storage_sql(self, test_db): """, ) - try: - with test_db.transaction(): - test_db.command( - "sql", - "INSERT INTO SqlNativeInt8SearchDoc SET id = ?, vec = ?", - "doc_a", - arcadedb.to_java_byte_array([127, 0, 0, 0]), - ) - test_db.command( - "sql", - "INSERT INTO SqlNativeInt8SearchDoc SET id = ?, vec = ?", - "doc_b", - arcadedb.to_java_byte_array([120, 10, 0, 0]), - ) - test_db.command( - "sql", - "INSERT INTO SqlNativeInt8SearchDoc SET id = ?, vec = ?", - "doc_c", - arcadedb.to_java_byte_array([0, 127, 0, 0]), - ) - except arcadedb.ArcadeDBError as exc: - if "Expected float array or ComparableVector as key" in str(exc): - pytest.skip( - "Current embedded engine build does not support byte[] ingest " - "for INT8-encoded vectors" - ) - raise + with test_db.transaction(): + test_db.command( + "sql", + "INSERT INTO SqlNativeInt8SearchDoc SET id = ?, vec = ?", + "doc_a", + arcadedb.to_java_byte_array([127, 0, 0, 0]), + ) + test_db.command( + "sql", + "INSERT INTO SqlNativeInt8SearchDoc SET id = ?, vec = ?", + "doc_b", + arcadedb.to_java_byte_array([120, 10, 0, 0]), + ) + test_db.command( + "sql", + "INSERT INTO SqlNativeInt8SearchDoc SET id = ?, vec = ?", + "doc_c", + arcadedb.to_java_byte_array([0, 127, 0, 0]), + ) rows = test_db.query( "sql", @@ -537,23 +525,16 @@ def test_sparse_vector_neighbors_sql(self, test_db): test_db.command("sql", "CREATE PROPERTY SparseDoc.id STRING") test_db.command("sql", "CREATE PROPERTY SparseDoc.tokens ARRAY_OF_INTEGERS") test_db.command("sql", "CREATE PROPERTY SparseDoc.weights ARRAY_OF_FLOATS") - try: - test_db.command( - "sql", - """ - CREATE INDEX ON SparseDoc (tokens, weights) - LSM_SPARSE_VECTOR - METADATA { - "dimensions": 128 - } - """, - ) - except arcadedb.ArcadeDBError as exc: - if "LSM_SPARSE_VECTOR' is not supported" in str(exc): - pytest.skip( - "Current embedded engine build does not support LSM_SPARSE_VECTOR" - ) - raise + test_db.command( + "sql", + """ + CREATE INDEX ON SparseDoc (tokens, weights) + LSM_SPARSE_VECTOR + METADATA { + "dimensions": 128 + } + """, + ) with test_db.transaction(): test_db.command( @@ -684,12 +665,7 @@ def test_vector_neighbors_by_key_sql(self, test_db): def test_vector_neighbors_by_key_opencypher(self, test_db): """OpenCypher should expose vector.neighbors with key-based lookup.""" - try: - _ = list(test_db.query("opencypher", "RETURN 1 AS one")) - except Exception as exc: - if "Query engine 'opencypher' was not found" in str(exc): - pytest.skip("OpenCypher not available") - raise + _ = list(test_db.query("opencypher", "RETURN 1 AS one")) test_db.command("sql", "CREATE VERTEX TYPE Doc") test_db.command("sql", "CREATE PROPERTY Doc.name STRING") diff --git a/pyproject.toml b/pyproject.toml index 490dcbf525e..91b56e0370e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -99,5 +99,4 @@ markers = [ "server: tests that require server/studio support", "server_wire: speaks a bundled wire protocol with its real client", "integration: tests that require external components", - "graph_export: tests that require GraphML/GraphSON support (the arcadedb-gremlin module)", ] From a149d46a385bce995b4c5b74bc72a301dd96500f Mon Sep 17 00:00:00 2001 From: Taewoon Kim Date: Tue, 6 Oct 2026 14:31:03 +0900 Subject: [PATCH 2/3] tests: zero skips in CI: files a platform cannot run are not collected, the gate lists no skip, unavoidable ones are added with a reason (#207) test_sigint.py is left out of collection on Windows and test_docs_examples.py on the upstream pull request branch (collect_ignore in conftest.py), the Windows-impossible directory name is not generated there, and test_example11 fails instead of skipping when its file is missing. ALLOWED_SKIPS in scripts/check_test_skips.py is empty; a truly unavoidable skip (a Windows limitation, a case that waits for an engine fix) is added with its platform, reason, and upstream issue. CI installs every optional package the tests import, so none skips there. The per-test doc pages no longer describe the removed skips. Full suite on the official 26.10.1 wheel: 810 passed, 9 xfailed, 0 skipped. Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_01Ubz3m6QXHESerCkehC1qgi --- bindings/python/docs/development/ci-setup.md | 15 ++--- .../development/testing/best-practices.md | 5 +- .../docs/development/testing/overview.md | 44 ++++++++------ .../docs/development/testing/test-core.md | 2 +- .../testing/test-example11-degree-matching.md | 2 +- .../testing/test-geo-predicate-sql.md | 2 +- .../testing/test-graph-algorithms-sql.md | 2 +- .../testing/test-hash-index-schema.md | 2 +- .../docs/development/testing/test-importer.md | 8 +-- .../development/testing/test-jvm-payload.md | 2 +- .../docs/development/testing/test-jvm.md | 2 +- .../development/testing/test-numpy-support.md | 2 +- .../testing/test-server-packaging.md | 2 +- .../testing/test-timeseries-sql.md | 2 +- .../test-vector-params-verification.md | 2 +- .../development/testing/test-vector-sql.md | 8 +-- .../docs/development/testing/test-vector.md | 4 +- bindings/python/scripts/check_test_skips.py | 30 ++++------ bindings/python/tests/conftest.py | 10 ++++ .../python/tests/test_check_test_skips.py | 60 +++++++------------ bindings/python/tests/test_docs_examples.py | 4 -- .../tests/test_example11_degree_matching.py | 5 -- bindings/python/tests/test_importer_api.py | 7 +-- bindings/python/tests/test_sigint.py | 4 -- 24 files changed, 104 insertions(+), 122 deletions(-) diff --git a/bindings/python/docs/development/ci-setup.md b/bindings/python/docs/development/ci-setup.md index abe434c07b8..d8552d34f46 100644 --- a/bindings/python/docs/development/ci-setup.md +++ b/bindings/python/docs/development/ci-setup.md @@ -101,13 +101,14 @@ What must pass before a change is green, beyond the tests themselves: `bindings/python/pyproject.toml` (with the `test`, `vector`, `examples`, `arrow`, and `pandas` extras) are resolved to their lowest allowed versions for every Python version in the classifiers, and `pip-audit` checks the result. -- **No unaccepted skips** (`test` job): a skipped test did not run, so the job fails when - any skip in the JUnit XML has a reason that `scripts/check_test_skips.py` does not list. - The list is short and each entry says why the test cannot run on that platform: the - Windows file name and SIGINT tests, and the docs-example tests on the upstream pull - request branch, which has no `docs/`. A skip for a missing package (`could not import`, which is what - `pytest.importorskip` gives, so call it without its own `reason=`) or for a feature the - wheel always ships is therefore a failure, and a new test dependency must be added both +- **No skips** (`test` job): a skipped test did not run, so the job fails on any skip in the + JUnit XML (`scripts/check_test_skips.py`; its list of accepted skips is empty). A test file + that cannot run on a platform is left out of collection in `tests/conftest.py` + (`collect_ignore`: `test_sigint.py` on Windows, `test_docs_examples.py` on the upstream pull + request branch, which has no `docs/`), so it is not reported as skipped. A skip for a + missing package (`could not import`, which is what `pytest.importorskip` gives, so call it + without its own `reason=`) or for a feature the wheel always ships is therefore a failure, + and a skip that is truly unavoidable (a Windows limitation, a case that needs an engine fix that is still upstream) is added to the list with the platform, the reason, and the upstream issue (for an engine bug a strict `xfail` is better: it fails the suite once the fix arrives). A new test dependency must be added both to the `test` extra in `bindings/python/pyproject.toml` and to the "Install wheel and test dependencies" step of `test-python-bindings.yml`. The repo-root `pyproject.toml` carries the same packages for local runs. diff --git a/bindings/python/docs/development/testing/best-practices.md b/bindings/python/docs/development/testing/best-practices.md index 8544dfad799..8b52999b5cf 100644 --- a/bindings/python/docs/development/testing/best-practices.md +++ b/bindings/python/docs/development/testing/best-practices.md @@ -217,8 +217,9 @@ except Exception: other bundled feature runs and fails when the feature is missing: a guard that skips cannot notice the feature going missing (the server JARs left the wheel in 26.7.2 and the guarded tests skipped into a green suite). Skip only for an optional Python package, - through `pytest.importorskip` without a custom reason, or for a platform that cannot run - the test; CI fails every other skip (`scripts/check_test_skips.py`). A server test carries + through `pytest.importorskip` without a custom reason, and leave a file that a platform + cannot run out of collection (`collect_ignore` in `tests/conftest.py`); CI fails every + skip (`scripts/check_test_skips.py`). A server test carries `@pytest.mark.server`. 4. **One JVM serves the whole session.** A `start_jvm()` call with a different configuration raises "already started", and engine-wide settings carry from one test to the next, so diff --git a/bindings/python/docs/development/testing/overview.md b/bindings/python/docs/development/testing/overview.md index 57b017dc587..193368efb8c 100644 --- a/bindings/python/docs/development/testing/overview.md +++ b/bindings/python/docs/development/testing/overview.md @@ -209,27 +209,35 @@ uv run pytest -m "not server and not server_wire" \ A passing run ends with a summary of the form `N passed, M skipped, K xfailed`, with no failures or errors. The strict xfails are the engine bugs listed on the Known Engine Issues -page; on Linux and macOS nothing skips. Run with `-rs` to see why a test skipped. +page, and nothing skips. Run with `-rs` to see why a test skipped locally. ## Skips -A skip is a test that did not run, so the suite keeps them to what cannot run: - -- **The platform**: on Windows, `test_importer_api.py` skips a file name with a question mark and - `test_sigint.py` skips its child-process interrupts. -- **The upstream pull request branch has no `docs/`**: `test_docs_examples.py` skips there. -- **An optional Python package**: numpy, pandas, pyarrow, requests, psycopg, - adbc-driver-postgresql, or neo4j, through `pytest.importorskip`, so a missing one is - visible to the CI gate below. - -A test never skips because the engine or the wheel lacks a feature it ships (OpenCypher, -geo and graph-algorithm SQL functions, time series, the HASH index, vector encodings, the -importers, the server stack): that is a failure. Earlier versions of these tests skipped on -the engine's error or on an empty answer, which let a wrong empty answer pass as a skip. - -CI enforces this: the `test` job runs `scripts/check_test_skips.py` over the JUnit XML and -fails on any skip whose reason is not on its short list (`tests/test_check_test_skips.py` -tests the gate). See [CI Gates](../ci-setup.md#ci-gates). +CI runs the suite with no skips: `scripts/check_test_skips.py` fails the `test` job on any +skip in the JUnit XML (`tests/test_check_test_skips.py` tests the gate). A skip is a test that +should have run and did not, so the suite does not use one for anything it can state +otherwise: + +- **A test file that cannot run on a platform is left out of collection**, not skipped: + `tests/conftest.py` sets `collect_ignore` for `test_sigint.py` on Windows (it sends SIGINT to + a child process) and for `test_docs_examples.py` on the upstream pull request branch, which + has no `docs/`. A parametrized case Windows cannot create (a directory name with a question + mark in `test_importer_api.py`) is not generated there. +- **An optional Python package** (numpy, pandas, pyarrow, requests, psycopg, + adbc-driver-postgresql, neo4j) uses `pytest.importorskip` without a custom reason. A run + without the package skips locally; CI installs them all, so a missing one fails the job. +- **A bundled feature never skips**: OpenCypher, the geo and graph-algorithm SQL functions, + time series, the HASH index, vector encodings, the importers, and the server stack run and + fail when they are missing. Earlier versions of these tests skipped on the engine's error or + on an empty answer, which let a wrong empty answer pass as a skip. + +A skip that is truly unavoidable (a Windows limitation, a case that needs an engine fix that is +still upstream) is added to the list in `scripts/check_test_skips.py` with the platform, the reason, +and the upstream issue; for an engine bug prefer a strict `xfail`, which fails the suite once the +fix arrives. CI installs every optional package the tests import (`numpy`, `pandas`, `pyarrow`, +`requests`, `psycopg`, `neo4j`, `redis`, `adbc-driver-postgresql`), so none of them skips there. + +See [CI Gates](../ci-setup.md#ci-gates). ## Next Steps diff --git a/bindings/python/docs/development/testing/test-core.md b/bindings/python/docs/development/testing/test-core.md index 4bfd8e0cfe9..1170cfd3c51 100644 --- a/bindings/python/docs/development/testing/test-core.md +++ b/bindings/python/docs/development/testing/test-core.md @@ -70,7 +70,7 @@ Tests validate: ### Query Languages -- **test_opencypher_queries**: Tests OpenCypher `CREATE` and `MATCH` queries (skips if the opencypher engine is unavailable) +- **test_opencypher_queries**: Tests OpenCypher `CREATE` and `MATCH` queries ### Result Materialization diff --git a/bindings/python/docs/development/testing/test-example11-degree-matching.md b/bindings/python/docs/development/testing/test-example11-degree-matching.md index d6d360f0a30..237f02a2491 100644 --- a/bindings/python/docs/development/testing/test-example11-degree-matching.md +++ b/bindings/python/docs/development/testing/test-example11-degree-matching.md @@ -6,7 +6,7 @@ Example 11 compares ArcadeDB against hnswlib-derived vector backends. ArcadeDB a `maxConnections` to every graph layer, while hnswlib-derived indexes allocate `2*M` links at the base layer, so the example converts one to the other. These tests check that conversion, `hnsw_m_from_max_connections()`, loaded from -`examples/11_vector_index_build.py`. The module skips when that file is absent. +`examples/11_vector_index_build.py`. The tests fail when that file is absent. ## Test Cases diff --git a/bindings/python/docs/development/testing/test-geo-predicate-sql.md b/bindings/python/docs/development/testing/test-geo-predicate-sql.md index 7c9517c4cb2..cc84876f331 100644 --- a/bindings/python/docs/development/testing/test-geo-predicate-sql.md +++ b/bindings/python/docs/development/testing/test-geo-predicate-sql.md @@ -16,4 +16,4 @@ Asserts that `geo.within` returns `true` for a point inside a polygon on two con ## Runtime Guard -If the packaged runtime does not include the geo SQL functions, these tests skip cleanly. +The wheel always ships the geo SQL functions; a missing one fails these tests. diff --git a/bindings/python/docs/development/testing/test-graph-algorithms-sql.md b/bindings/python/docs/development/testing/test-graph-algorithms-sql.md index a6a6ab1ded4..c99ffdb3c0b 100644 --- a/bindings/python/docs/development/testing/test-graph-algorithms-sql.md +++ b/bindings/python/docs/development/testing/test-graph-algorithms-sql.md @@ -28,4 +28,4 @@ Ensures disconnected `shortestPath(...)` queries do not produce a misleading mul ## Runtime Guard -If the packaged runtime does not include `shortestPath`, `dijkstra`, or `astar`, these tests skip instead of reporting a false regression. +The wheel always ships `shortestPath`, `dijkstra`, and `astar`; a missing one fails these tests. diff --git a/bindings/python/docs/development/testing/test-hash-index-schema.md b/bindings/python/docs/development/testing/test-hash-index-schema.md index a4edec249e8..02b07b603c3 100644 --- a/bindings/python/docs/development/testing/test-hash-index-schema.md +++ b/bindings/python/docs/development/testing/test-hash-index-schema.md @@ -24,4 +24,4 @@ These tests cover HASH index creation and discovery through the Python schema AP ## Runtime Guard -If the current packaged runtime does not support `IndexType.HASH`, the two schema-API HASH tests skip instead of failing spuriously. `test_indexed_in_named_list_parameter_returns_rows` uses `LSM_TREE` and the `UNIQUE_HASH` test uses SQL, so neither has such a guard. +The wheel always ships the HASH index type; a refusal of `IndexType.HASH` fails the two schema-API HASH tests. diff --git a/bindings/python/docs/development/testing/test-importer.md b/bindings/python/docs/development/testing/test-importer.md index f6d6ffb77ba..730ab10b451 100644 --- a/bindings/python/docs/development/testing/test-importer.md +++ b/bindings/python/docs/development/testing/test-importer.md @@ -37,16 +37,16 @@ with arcadedb.create_database("./mydb") as db: - **test_import_database_csv_documents**: `IMPORT DATABASE file://...csv` stores 3 `Document` records. - **test_import_database_csv_documents_with_quoted_parallel_setting**: the same CSV through ``IMPORT DATABASE WITH documents = ..., documentsFileType = 'csv', documentType = 'Document', `parallel` = 1`` (a quoted `parallel` setting) stores 3 records. -- **test_import_database_csv_graph_vertices_and_edges**: the vertex and edge CSV fixtures import at least 6 vertices and 3 edges (skips if the fixtures are missing). +- **test_import_database_csv_graph_vertices_and_edges**: the vertex and edge CSV fixtures import at least 6 vertices and 3 edges (asserts the fixtures exist). - **test_import_database_csv_graph_vertices_and_edges_with_quoted_parallel**: the same with a quoted `parallel` setting. -- **test_import_database_xml_vertices**: an XML file imported with `entityType = 'VERTEX'` stores 2 `v_user` vertices (skips on the Windows runtime, where the engine-side XML path fails). +- **test_import_database_xml_vertices**: an XML file imported with `entityType = 'VERTEX'` stores 2 `v_user` vertices. - **test_import_database_neo4j_fixture**: a Neo4j export imports and leaves at least one type in the schema. - **test_import_database_word2vec_vectors**: a Word2Vec file imports at least 10 `Word` records. -- **test_import_database_rdf_fixture**: an RDF fixture imports, and `schema:types` is non-empty afterwards (it counts types, not records); it skips without an RDF importer and on the Windows parse failure. +- **test_import_database_rdf_fixture**: an RDF fixture imports, and `schema:types` is non-empty afterwards (it counts types, not records). - **test_import_database_into_timeseries_type**: `IMPORT DATABASE ... WITH documentType = 'Telemetry'` into a TIMESERIES type raises an `ArcadeDBError` mentioning "importing database", and the type still has 0 rows. The importer cannot place a document in a TIMESERIES type, so this pins the failure rather than an import path. - **test_import_database_with_missing_file_fails**: a missing file raises `ArcadeDBError`. -The Neo4j, Word2Vec, and RDF tests skip when their fixture is missing or the runtime lacks that importer. The fixtures come from `integration/src/test/resources/` in the repository checkout (`importer-vertices.csv`, `importer-edges.csv`, `neo4j-export-mini.jsonl`, `importer-word2vec.txt`, and `importer-rdf.xml`). `test_import_database_into_timeseries_type` skips if `CREATE TIMESERIES TYPE` is rejected. +The Neo4j, Word2Vec, and RDF tests assert that their fixture exists and fail when the runtime lacks the importer. The fixtures come from `integration/src/test/resources/` in the repository checkout (`importer-vertices.csv`, `importer-edges.csv`, `neo4j-export-mini.jsonl`, `importer-word2vec.txt`, and `importer-rdf.xml`). `test_import_database_into_timeseries_type` skips if `CREATE TIMESERIES TYPE` is rejected. `test_importer_api.py`: diff --git a/bindings/python/docs/development/testing/test-jvm-payload.md b/bindings/python/docs/development/testing/test-jvm-payload.md index e6be2e5264b..ec40ec3744f 100644 --- a/bindings/python/docs/development/testing/test-jvm-payload.md +++ b/bindings/python/docs/development/testing/test-jvm-payload.md @@ -16,7 +16,7 @@ Runs the checker's self-test first: a check that quietly stops matching looks ex No file under `benchmarks/experiments`, `bindings/python/src`, `bindings/python/examples`, or `bindings/python/tests` carries a site where a `.tolist()` flows into a call that crosses into the JVM. -Each test skips when `benchmarks/experiments` is not checked out, because the bindings are distributed without it. +Each test fails when `benchmarks/experiments` is not checked out. The file stays in the fork (`make-upstream-pr-branch.sh` excludes it from the upstream pull request). ## Running diff --git a/bindings/python/docs/development/testing/test-jvm.md b/bindings/python/docs/development/testing/test-jvm.md index 38b96ee9cda..6d7f26a80d9 100644 --- a/bindings/python/docs/development/testing/test-jvm.md +++ b/bindings/python/docs/development/testing/test-jvm.md @@ -34,7 +34,7 @@ database without closing it; the test asserts it prints `OK` and exits 0 within ## Ctrl-C (`test_sigint.py`) -Each case starts a child process, sends it SIGINT after the JVM is up, and reads what it printed (humemai/arcadedb-embedded-python#118). JPype's default in a script is `interrupt=True`: the JVM ends the whole process with status 130 and no `KeyboardInterrupt`, `finally`, or `atexit` runs. `start_jvm()` now passes `interrupt=False`. +Each case starts a child process, sends it SIGINT after the JVM is up, and reads what it printed (humemai/arcadedb-embedded-python#118). Windows cannot deliver SIGINT to a child process, so `tests/conftest.py` leaves this file out of collection there (`collect_ignore`) rather than reporting skips. JPype's default in a script is `interrupt=True`: the JVM ends the whole process with status 130 and no `KeyboardInterrupt`, `finally`, or `atexit` runs. `start_jvm()` now passes `interrupt=False`. - **a Python loop and a blocked Java call that Ctrl-C cannot wake (a socket `accept()` that times out after 4 s)**: inside `with db.transaction():` that inserted a row, Ctrl-C raises `KeyboardInterrupt` (in the Java case when the call returns), the transaction is rolled back (the count is 0), `finally` and `atexit` run, and the exit status is 0. - **`interrupt=True` keeps the old behavior**: exit status 130 and no `KeyboardInterrupt`. diff --git a/bindings/python/docs/development/testing/test-numpy-support.md b/bindings/python/docs/development/testing/test-numpy-support.md index 73c0a287569..941d6709000 100644 --- a/bindings/python/docs/development/testing/test-numpy-support.md +++ b/bindings/python/docs/development/testing/test-numpy-support.md @@ -2,7 +2,7 @@ [View source code]({{ config.repo_url }}/blob/{{ config.extra.version_tag }}/bindings/python/tests/test_numpy_support.py){ .md-button } -These tests cover automatic conversion of NumPy arrays passed into `db.command()`, `db.query()`, and regular transactions. Each test is guarded by `@pytest.mark.skipif(not HAS_NUMPY, ...)`. +These tests cover automatic conversion of NumPy arrays passed into `db.command()`, `db.query()`, and regular transactions. The module calls `pytest.importorskip("numpy")`. ## Coverage diff --git a/bindings/python/docs/development/testing/test-server-packaging.md b/bindings/python/docs/development/testing/test-server-packaging.md index 447456aa989..f72cc855a10 100644 --- a/bindings/python/docs/development/testing/test-server-packaging.md +++ b/bindings/python/docs/development/testing/test-server-packaging.md @@ -20,7 +20,7 @@ The studio JAR is present and contains no `.class` entries: Studio is static ass ### 4) server starts and serves http -Marked `server`; skips without `requests`. The bundled server starts, and `GET /api/v1/server` returns 200 with a `version` field. +Marked `server`; needs `requests` (`importorskip`). The bundled server starts, and `GET /api/v1/server` returns 200 with a `version` field. ## Running diff --git a/bindings/python/docs/development/testing/test-timeseries-sql.md b/bindings/python/docs/development/testing/test-timeseries-sql.md index 0fb8f1cf1a2..f0f8055df66 100644 --- a/bindings/python/docs/development/testing/test-timeseries-sql.md +++ b/bindings/python/docs/development/testing/test-timeseries-sql.md @@ -20,4 +20,4 @@ Appends 5,000 samples with `append_samples()`, runs `COMPACT TIMESERIES TYPE Tem ## Runtime Guard -If the packaged runtime does not support `CREATE TIMESERIES TYPE`, these tests skip cleanly. +The wheel always ships time series, so a failing `CREATE TIMESERIES TYPE` fails these tests; none skips. diff --git a/bindings/python/docs/development/testing/test-vector-params-verification.md b/bindings/python/docs/development/testing/test-vector-params-verification.md index c01e6eab133..fbec81add3c 100644 --- a/bindings/python/docs/development/testing/test-vector-params-verification.md +++ b/bindings/python/docs/development/testing/test-vector-params-verification.md @@ -24,7 +24,7 @@ All the tests are in `TestVectorParams`. - **test_quantization_none**, **test_quantization_binary**, **test_quantization_product**: the same two checks for `NONE`, `BINARY`, and `PRODUCT`. - **test_store_vectors_in_graph_param**: `store_vectors_in_graph=True` shows up as `storeVectorsInGraph` true in the index metadata. - **test_add_hierarchy_param**: `add_hierarchy=True` shows up as `addHierarchy` true in the index metadata. -- **test_encoding_param**: an index on a `BINARY` property with `quantization="NONE", encoding="INT8"` has metadata `encoding == INT8` and `quantizationType == NONE`. It skips if the engine build does not support or expose encoding. +- **test_encoding_param**: an index on a `BINARY` property with `quantization="NONE", encoding="INT8"` has metadata `encoding == INT8` and `quantizationType == NONE`. - **test_encoding_int8_rejects_default_int8_quantization**: `encoding="INT8"` without an explicit quantization raises `ArcadeDBError` naming `encoding='INT8'` and `quantization='INT8'`. - **test_per_index_cache_params**: `location_cache_size=123` raises `ValueError` ("no longer supported", removed by the engine in #5559 and #5568); `graph_build_cache_size=456` and `mutations_before_rebuild=789` reach the index metadata as `graphBuildCacheSize == 456` and `mutationsBeforeRebuild == 789`. - **test_wrapper_default_matches_engine_default**: the default of `create_vector_index(max_connections=...)` equals `maxConnections` on a freshly constructed engine `LSMVectorIndexMetadata`. diff --git a/bindings/python/docs/development/testing/test-vector-sql.md b/bindings/python/docs/development/testing/test-vector-sql.md index aa485d8b35a..ad03fd6410c 100644 --- a/bindings/python/docs/development/testing/test-vector-sql.md +++ b/bindings/python/docs/development/testing/test-vector-sql.md @@ -52,8 +52,8 @@ Tests validate: - **test_int8_quantization_boundary_condition_sql**: INT8 quantized `LSM_VECTOR` index (Dim=16, N=10) builds and accepts a `vectorNeighbors` query without error; the test asserts only that the projection returns a row, not that it holds a neighbour. - **test_create_index_with_quantization_int8_sql**: Creates an `INT8` quantized `LSM_VECTOR` index, inserts N=50 vectors, and verifies `vectorNeighbors` returns one neighbour (the returned vector's values are not checked). - **test_create_index_with_quantization_binary_sql**: Creates a `BINARY` quantized `LSM_VECTOR` index (Dim=128) with `storeVectorsInGraph` and verifies search. -- **test_create_index_with_native_int8_encoding_sql**: Creates an `LSM_VECTOR` index on a `BINARY` property with `"quantization": "NONE", "encoding": "INT8"` and verifies the metadata (skips if the build does not expose `encoding`). -- **test_vector_neighbors_on_native_int8_storage_sql**: Verifies `vectorNeighbors` works against native INT8-encoded storage ingested as byte arrays (skips if unsupported). +- **test_create_index_with_native_int8_encoding_sql**: Creates an `LSM_VECTOR` index on a `BINARY` property with `"quantization": "NONE", "encoding": "INT8"` and verifies the metadata. +- **test_vector_neighbors_on_native_int8_storage_sql**: Verifies `vectorNeighbors` works against native INT8-encoded storage ingested as byte arrays. ### Index Creation & Metadata @@ -65,9 +65,9 @@ Tests validate: - **test_vector_neighbors**: `vectorNeighbors(indexName, vector, k)` on a basic `LSM_VECTOR` index. - **test_vector_neighbors_accepts_parameterized_index_and_vector**: `vectorNeighbors(?, ?, ?)` accepts bound index name, vector, and k parameters. - **test_vector_neighbors_by_key_sql**: `vectorNeighbors('Word[vector]', 'docA', 3)` searches from an existing record key. -- **test_vector_neighbors_by_key_opencypher**: OpenCypher exposes `CALL vector.neighbors(...)` with key-based lookup (skips if OpenCypher is unavailable). +- **test_vector_neighbors_by_key_opencypher**: OpenCypher exposes `CALL vector.neighbors(...)` with key-based lookup. - **test_vector_neighbors_group_by_sql**: `vector.neighbors` supports `{ groupBy, groupSize }` options. -- **test_sparse_vector_neighbors_sql**: `LSM_SPARSE_VECTOR` index plus `vector.sparseNeighbors` top-K retrieval (skips if `LSM_SPARSE_VECTOR` is unsupported). +- **test_sparse_vector_neighbors_sql**: `LSM_SPARSE_VECTOR` index plus `vector.sparseNeighbors` top-K retrieval. ### End-to-End Search diff --git a/bindings/python/docs/development/testing/test-vector.md b/bindings/python/docs/development/testing/test-vector.md index 426d86b2965..15fce40edfb 100644 --- a/bindings/python/docs/development/testing/test-vector.md +++ b/bindings/python/docs/development/testing/test-vector.md @@ -63,7 +63,7 @@ What the tests cover: ### Approximate search (PRODUCT quantization) - **test_lsm_vector_search_approximate_product**: on a `PRODUCT` index (a `TypeIndex` wrapper), `find_nearest_approximate(k=1)` returns the closest vector. -- **test_lsm_vector_search_approximate_typeindex**: the same through the `TypeIndex` wrapper path; skips if the build does not return one. +- **test_lsm_vector_search_approximate_typeindex**: the same through the `TypeIndex` wrapper path (asserts the build returns one). - **test_lsm_vector_search_approximate_fallback**: on an index without `PRODUCT` quantization, `find_nearest_approximate()` raises `ArcadeDBError` (despite the test name, it asserts the error). - **test_lsm_vector_search_approximate_product_requires_enough_vectors**: a `PRODUCT` index on too few vectors raises `ArcadeDBError` mentioning `pq_clusters`. - **test_lsm_vector_search_approximate_returns_k**: with 261 vectors (5 hand-picked plus 256 fillers), `find_nearest_approximate(k=2)` returns exactly 2 results, each with a record and a distance. @@ -83,7 +83,7 @@ What the tests cover: - **test_lsm_cosine_distance_45_degree_vectors**: vectors 45° apart are at the expected cosine distance. - **test_lsm_cosine_distance_3d_orthogonal_vectors**: orthogonal 3-D vectors are at distance 1.0. - **test_lsm_cosine_distance_3d_parallel_and_opposite**: parallel 3-D vectors are at distance below 0.01, opposite ones at 2.0. -- **test_lsm_cosine_distance_high_dimensional**: in 128 dimensions, parallel, opposite, and near-orthogonal vectors are at about 0, 2.0, and 1.0 (each check runs only for a vector that comes back; orthogonal tolerance 0.1; skips without NumPy). +- **test_lsm_cosine_distance_high_dimensional**: in 128 dimensions, parallel, opposite, and near-orthogonal vectors are at about 0, 2.0, and 1.0 (each check runs only for a vector that comes back; orthogonal tolerance 0.1; needs NumPy through `importorskip`). - **test_lsm_euclidean_distance**: with `EUCLIDEAN`, the reported distances are 0.0 for the origin and 25.0 for the point (3, 4) (the squared Euclidean distance from the origin), and the origin comes back first. ### Quantization diff --git a/bindings/python/scripts/check_test_skips.py b/bindings/python/scripts/check_test_skips.py index c4f23a7a711..fdf493bb690 100644 --- a/bindings/python/scripts/check_test_skips.py +++ b/bindings/python/scripts/check_test_skips.py @@ -4,8 +4,9 @@ A skip is a test that did not run. When it skips on "the runtime lacks a feature" or on a missing dependency, a regression or a broken install turns the suite green having exercised nothing, and a wrong empty answer can show up as a skip. This script reads the JUnit XML that -pytest wrote and exits 1 for every skip whose message is not on the list below. xfail results -are not skips and are not checked here: a strict xfail already fails the suite when it passes. +pytest wrote and exits 1 for every skip whose message is not on the list below, which is empty. +xfail results are not skips and are not checked here: a strict xfail already fails the suite +when it passes. usage: check_test_skips.py test-results.xml [--platform linux/amd64] @@ -21,24 +22,13 @@ import xml.etree.ElementTree as ET # nosec B405 - parses the JUnit file pytest just wrote from typing import Iterable -# (message pattern, operating systems it is allowed on, why) -ALLOWED_SKIPS = ( - ( - r"^a question mark is not allowed in a Windows file name$", - ("windows",), - "Windows cannot create the file", - ), - ( - r"^the test sends SIGINT to a child process$", - ("windows",), - "Windows has no SIGINT delivery to a child process", - ), - ( - r"^bindings/python/docs is not present on this branch$", - ("linux", "darwin", "windows"), - "the upstream pull request branch has no docs/ directory (the fork's tree always does)", - ), -) +# (message pattern, operating systems it is allowed on, why). Empty on purpose: every test runs on +# every platform in CI. A test file that cannot run on one is left out of collection in +# tests/conftest.py (collect_ignore), which reports nothing as skipped. Some skips are unavoidable +# (a Windows limitation, a case that needs an engine fix that is still upstream): add an entry for +# those, with the platform, the reason, and the upstream issue in the third field. For an engine +# bug prefer a strict xfail, which fails the suite as soon as the fix arrives. +ALLOWED_SKIPS: tuple[tuple[str, tuple[str, ...], str], ...] = () def skips(path: str) -> Iterable[tuple[str, str]]: diff --git a/bindings/python/tests/conftest.py b/bindings/python/tests/conftest.py index 18444f253ec..1bfe04d34d8 100644 --- a/bindings/python/tests/conftest.py +++ b/bindings/python/tests/conftest.py @@ -10,6 +10,16 @@ import pytest +# A test file that cannot run here is not collected, so nothing is reported as skipped: a skip means +# a test that should have run, and scripts/check_test_skips.py fails the CI job on any skip. +collect_ignore = [] +if sys.platform == "win32": + # test_sigint.py sends SIGINT to a child process, which Windows cannot deliver + collect_ignore.append("test_sigint.py") +if not os.path.isdir(os.path.join(os.path.dirname(os.path.dirname(__file__)), "docs")): + # the upstream pull request branch has no docs/ directory + collect_ignore.append("test_docs_examples.py") + @pytest.hookimpl(trylast=True) def pytest_configure(config): diff --git a/bindings/python/tests/test_check_test_skips.py b/bindings/python/tests/test_check_test_skips.py index d3821830c65..84c7fb68a3d 100644 --- a/bindings/python/tests/test_check_test_skips.py +++ b/bindings/python/tests/test_check_test_skips.py @@ -40,55 +40,41 @@ def test_a_run_with_no_skips_passes(tmp_path, capsys): assert "OK" in capsys.readouterr().out -def test_the_docs_branch_skip_passes_everywhere(tmp_path): - module = _load() - xml = _junit( - tmp_path / "r.xml", - [ - ( - "test_docs_index_and_quickstart_examples", - "pytest.skip", - "bindings/python/docs is not present on this branch", - ) - ], - ) - for platform in ("linux/amd64", "darwin/arm64", "windows/amd64"): - assert module.main([xml, "--platform", platform]) == 0, platform - - -def test_a_windows_only_skip_fails_on_linux(tmp_path, capsys): - module = _load() - xml = _junit( - tmp_path / "r.xml", - [ - ( - "test_sigint", - "pytest.skip", - "the test sends SIGINT to a child process", - ) - ], - ) - assert module.main([xml, "--platform", "windows/amd64"]) == 0 - assert module.main([xml, "--platform", "linux/arm64"]) == 1 - assert "test_sigint" in capsys.readouterr().out - - @pytest.mark.parametrize( "message", [ "OpenCypher not available", "Requires GraphML/GraphSON support", - "could not import 'pyarrow': No module named 'pyarrow'", "Requires server support", + "the test sends SIGINT to a child process", + "bindings/python/docs is not present on this branch", + "could not import 'pyarrow': No module named 'pyarrow'", "NumPy not installed", ], ) -def test_a_skip_for_a_missing_feature_or_package_fails(tmp_path, message, capsys): +def test_every_skip_fails_by_default(tmp_path, message, capsys): module = _load() + assert module.ALLOWED_SKIPS == () xml = _junit(tmp_path / "r.xml", [("test_y", "pytest.skip", message)]) - assert module.main([xml, "--platform", "linux/amd64"]) == 1 + for platform in ("linux/amd64", "darwin/arm64", "windows/amd64"): + assert module.main([xml, "--platform", platform]) == 1, platform out = capsys.readouterr().out - assert "ERROR" in out and message in out + assert "ERROR" in out and message in out and "test_y" in out + + +def test_an_accepted_skip_passes_only_on_the_platforms_it_names( + tmp_path, monkeypatch, capsys +): + module = _load() + monkeypatch.setattr( + module, + "ALLOWED_SKIPS", + ((r"^no SIGINT here$", ("windows",), "Windows cannot do it"),), + ) + xml = _junit(tmp_path / "r.xml", [("test_s", "pytest.skip", "no SIGINT here")]) + assert module.main([xml, "--platform", "windows/amd64"]) == 0 + assert module.main([xml, "--platform", "linux/arm64"]) == 1 + assert "test_s" in capsys.readouterr().out def test_an_xfail_is_not_a_skip(tmp_path): diff --git a/bindings/python/tests/test_docs_examples.py b/bindings/python/tests/test_docs_examples.py index 37d69b6114e..069fd53e9be 100644 --- a/bindings/python/tests/test_docs_examples.py +++ b/bindings/python/tests/test_docs_examples.py @@ -10,10 +10,6 @@ DOCS_ROOT = Path(__file__).resolve().parents[1] / "docs" PYTHON_BLOCK_RE = re.compile(r"```python\n(.*?)```", re.DOTALL) -pytestmark = pytest.mark.skipif( - not DOCS_ROOT.exists(), - reason="bindings/python/docs is not present on this branch", -) def _doc_path(relative_path: str) -> Path: diff --git a/bindings/python/tests/test_example11_degree_matching.py b/bindings/python/tests/test_example11_degree_matching.py index ef7dd2b612e..668b0570225 100644 --- a/bindings/python/tests/test_example11_degree_matching.py +++ b/bindings/python/tests/test_example11_degree_matching.py @@ -17,11 +17,6 @@ Path(__file__).resolve().parents[1] / "examples" / "11_vector_index_build.py" ) -pytestmark = pytest.mark.skipif( - not EXAMPLE_PATH.exists(), - reason="bindings/python/examples/11_vector_index_build.py is not present", -) - @pytest.fixture(scope="module") def example11(): diff --git a/bindings/python/tests/test_importer_api.py b/bindings/python/tests/test_importer_api.py index 0baaec2dd6b..39af7675967 100644 --- a/bindings/python/tests/test_importer_api.py +++ b/bindings/python/tests/test_importer_api.py @@ -213,12 +213,13 @@ def test_import_documents_rejects_unknown_on_row_error(temp_db_path, tmp_path): [ "with space", "hash#1", - "what?", "50%off", "semi;colon", "plus+and&", "caf\u00e9", - ], + ] + # Windows cannot create a file name with a question mark, so it is not generated there + + ([] if os.name == "nt" else ["what?"]), ) def test_import_documents_path_with_special_characters( temp_db_path, tmp_path, directory_name @@ -226,8 +227,6 @@ def test_import_documents_path_with_special_characters( """Path.as_uri() percent-encodes a space, `#`, `%`, and non-ASCII characters, and the engine opens what follows `file://` as a plain path without decoding it, so such a directory name failed. """ - if os.name == "nt" and "?" in directory_name: - pytest.skip("a question mark is not allowed in a Windows file name") directory = tmp_path / directory_name directory.mkdir() csv_path = directory / "people.csv" diff --git a/bindings/python/tests/test_sigint.py b/bindings/python/tests/test_sigint.py index cd32d8c9b42..55369498e23 100644 --- a/bindings/python/tests/test_sigint.py +++ b/bindings/python/tests/test_sigint.py @@ -25,10 +25,6 @@ import pytest -pytestmark = pytest.mark.skipif( - sys.platform == "win32", reason="the test sends SIGINT to a child process" -) - _CHILD = """ import atexit, sys, time import arcadedb_embedded as arcadedb From a0ff773d1adb2b3433162722054f9a20ab4aaf00 Mon Sep 17 00:00:00 2001 From: Taewoon Kim Date: Tue, 6 Oct 2026 15:34:35 +0900 Subject: [PATCH 3/3] tests: the skip gate's own test no longer puts the importorskip reason text into the JUnit file (#207) The parametrized id carried "could not import 'pyarrow'", which the existing CI import gate greps for in test-results.xml, so a run in which nothing was missing failed it. The cases have explicit ids now. Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_01Ubz3m6QXHESerCkehC1qgi --- .../python/tests/test_check_test_skips.py | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/bindings/python/tests/test_check_test_skips.py b/bindings/python/tests/test_check_test_skips.py index 84c7fb68a3d..9b007ca4e11 100644 --- a/bindings/python/tests/test_check_test_skips.py +++ b/bindings/python/tests/test_check_test_skips.py @@ -40,16 +40,23 @@ def test_a_run_with_no_skips_passes(tmp_path, capsys): assert "OK" in capsys.readouterr().out +# The ids are explicit on purpose: CI greps the JUnit file for the importorskip reason text, and a +# parameter id that contained it would trip that gate on a run in which nothing is missing. @pytest.mark.parametrize( "message", [ - "OpenCypher not available", - "Requires GraphML/GraphSON support", - "Requires server support", - "the test sends SIGINT to a child process", - "bindings/python/docs is not present on this branch", - "could not import 'pyarrow': No module named 'pyarrow'", - "NumPy not installed", + pytest.param("OpenCypher not available", id="missing-feature"), + pytest.param("Requires GraphML/GraphSON support", id="gremlin"), + pytest.param("Requires server support", id="server"), + pytest.param("the test sends SIGINT to a child process", id="sigint"), + pytest.param( + "bindings/python/docs is not present on this branch", id="docs-branch" + ), + pytest.param( + "could not import 'pyarrow': No module named 'pyarrow'", + id="missing-package", + ), + pytest.param("NumPy not installed", id="numpy"), ], ) def test_every_skip_fails_by_default(tmp_path, message, capsys):