Skip to content
This repository was archived by the owner on Nov 21, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/workflows/test-python-bindings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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)"
Expand Down
18 changes: 11 additions & 7 deletions bindings/python/docs/development/ci-setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,17 @@ 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 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.
- **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
Expand Down
7 changes: 3 additions & 4 deletions bindings/python/docs/development/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 8 additions & 5 deletions bindings/python/docs/development/testing/best-practices.md
Original file line number Diff line number Diff line change
Expand Up @@ -213,9 +213,13 @@ 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, 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
Expand All @@ -237,7 +241,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):
Expand All @@ -248,7 +252,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()
Expand Down
59 changes: 29 additions & 30 deletions bindings/python/docs/development/testing/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand All @@ -208,37 +207,37 @@ 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, and nothing skips. Run with `-rs` to see why a test skipped locally.

## Skips

Beyond the tests above, a test skips when what it needs is missing:

- **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).
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

Expand Down
2 changes: 1 addition & 1 deletion bindings/python/docs/development/testing/test-core.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand All @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
10 changes: 4 additions & 6 deletions bindings/python/docs/development/testing/test-exporter.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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.

Expand Down Expand Up @@ -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)
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Loading
Loading