Skip to content

Commit 08be807

Browse files
authored
chore: CI/testing improvements for parallel test execution (#318)
1 parent fc1f7ed commit 08be807

File tree

4 files changed

+248
-1
lines changed

4 files changed

+248
-1
lines changed

packages/llama-index-integration-tests/pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ build-backend = "uv_build"
55
[dependency-groups]
66
dev = [
77
"basedpyright>=1.31.1",
8+
"psycopg[binary]>=3.2.0",
89
"pytest>=8.4.2",
910
"pytest-asyncio>=0.24.0",
1011
"pytest-cov>=7.0.0",
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# SPDX-License-Identifier: MIT
2+
# Copyright (c) 2026, LlamaIndex
3+
4+
"""PostgreSQL testcontainers connectivity tests.
5+
6+
These tests verify that the testcontainers PostgreSQL integration works correctly.
7+
They are marked with the 'docker' marker and require Docker to be running.
8+
9+
Run with: pytest -m docker
10+
"""
11+
12+
from __future__ import annotations
13+
14+
from typing import Generator
15+
16+
import pytest
17+
from testcontainers.postgres import PostgresContainer
18+
19+
20+
@pytest.fixture(scope="module")
21+
def postgres_container() -> Generator[PostgresContainer, None, None]:
22+
"""Module-scoped PostgreSQL container for connectivity tests.
23+
24+
Requires Docker to be running.
25+
"""
26+
from testcontainers.postgres import PostgresContainer
27+
28+
with PostgresContainer("postgres:16", driver=None) as postgres:
29+
yield postgres
30+
31+
32+
@pytest.mark.docker
33+
def test_postgres_container_starts(postgres_container: PostgresContainer) -> None:
34+
"""Test that the PostgreSQL container starts successfully."""
35+
# Container should be running if we got here
36+
assert postgres_container is not None
37+
connection_url = postgres_container.get_connection_url()
38+
assert "postgresql" in connection_url or "postgres" in connection_url
39+
40+
41+
@pytest.mark.docker
42+
def test_postgres_basic_query(postgres_container: PostgresContainer) -> None:
43+
"""Test basic SQL query execution against the PostgreSQL container."""
44+
import psycopg
45+
46+
connection_url = postgres_container.get_connection_url()
47+
48+
with psycopg.connect(connection_url) as conn:
49+
with conn.cursor() as cur:
50+
cur.execute("SELECT 1 AS test_value")
51+
result = cur.fetchone()
52+
assert result is not None
53+
assert result[0] == 1

packages/llama-index-utils-workflow/pyproject.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ dev = [
77
"pre-commit>=4.3.0",
88
"pytest>=8.4.2",
99
"pytest-asyncio>=1.0.0",
10-
"pytest-cov>=6.1.1"
10+
"pytest-cov>=6.1.1",
11+
"pytest-xdist>=3.8.0",
12+
"pytest-timeout>=2.4.0"
1113
]
1214

1315
[project]

0 commit comments

Comments
 (0)