Skip to content

Commit 97b1949

Browse files
committed
Remove postgres dependency
1 parent e551ee1 commit 97b1949

File tree

4 files changed

+19
-58
lines changed

4 files changed

+19
-58
lines changed

.github/workflows/ci.yml

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -145,25 +145,11 @@ jobs:
145145
command: ""
146146
- name: all-extras
147147
command: "--all-extras"
148-
services:
149-
# Postgres service container for DBOS tests
150-
postgres:
151-
image: postgres:16
152-
env:
153-
POSTGRES_PASSWORD: dbos
154-
options: >-
155-
--health-cmd pg_isready
156-
--health-interval 10s
157-
--health-timeout 5s
158-
--health-retries 5
159-
ports:
160-
- 5432:5432
161148

162149
env:
163150
UV_PYTHON: ${{ matrix.python-version }}
164151
CI: true
165152
COVERAGE_PROCESS_START: ./pyproject.toml
166-
DBOS_DATABASE_URL: postgresql://postgres:dbos@localhost:5432/postgres
167153
steps:
168154
- uses: actions/checkout@v4
169155

@@ -198,24 +184,10 @@ jobs:
198184
fail-fast: false
199185
matrix:
200186
python-version: ["3.10", "3.11", "3.12", "3.13"]
201-
services:
202-
# Postgres service container for DBOS tests
203-
postgres:
204-
image: postgres:16
205-
env:
206-
POSTGRES_PASSWORD: dbos
207-
options: >-
208-
--health-cmd pg_isready
209-
--health-interval 10s
210-
--health-timeout 5s
211-
--health-retries 5
212-
ports:
213-
- 5432:5432
214187
env:
215188
UV_PYTHON: ${{ matrix.python-version }}
216189
CI: true
217190
COVERAGE_PROCESS_START: ./pyproject.toml
218-
DBOS_DATABASE_URL: postgresql://postgres:dbos@localhost:5432/postgres
219191
steps:
220192
- uses: actions/checkout@v4
221193

pydantic_ai_slim/pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ ag-ui = ["ag-ui-protocol>=0.1.8", "starlette>=0.45.3"]
9595
retries = ["tenacity>=8.2.3"]
9696
# Temporal
9797
temporal = ["temporalio==1.16.0"]
98-
# DBOS
99-
dbos = ["dbos>=1.12.0"]
98+
# DBOS (Update version before merge)
99+
dbos = ["dbos>=1.13.0a5"]
100100

101101

102102
[tool.hatch.metadata]

tests/test_dbos.py

Lines changed: 13 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -42,28 +42,6 @@
4242
except ImportError: # pragma: lax no cover
4343
pytest.skip('DBOS is not installed', allow_module_level=True)
4444

45-
# Check if Postgres is available
46-
try:
47-
import psycopg
48-
49-
DBOS_DATABASE_URL = os.environ.get('DBOS_DATABASE_URL', 'postgresql://postgres:dbos@localhost:5432/postgres')
50-
# Connect to Postgres to see if it's running
51-
conn = None
52-
try:
53-
conn = psycopg.connect(
54-
DBOS_DATABASE_URL,
55-
)
56-
cursor = conn.cursor()
57-
cursor.execute('SELECT 1;')
58-
cursor.close()
59-
except Exception as error: # pragma: lax no cover
60-
pytest.skip(f'Postgres not available: {error}', allow_module_level=True)
61-
finally:
62-
if conn is not None: # pragma: lax no cover
63-
conn.close()
64-
except ImportError: # pragma: lax no cover
65-
pytest.skip('psycopg is not installed', allow_module_level=True)
66-
6745
try:
6846
import logfire
6947
from logfire.testing import CaptureLogfire
@@ -118,6 +96,17 @@ def uninstrument_pydantic_ai() -> Iterator[None]:
11896
Agent.instrument_all(False)
11997

12098

99+
# Automatically clean up old DBOS sqlite files
100+
@pytest.fixture(autouse=True, scope='module')
101+
def cleanup_test_sqlite_file() -> Iterator[None]:
102+
if os.path.exists('dbostest.sqlite'):
103+
os.remove('dbostest.sqlite') # pragma: lax no cover
104+
yield
105+
106+
if os.path.exists('dbostest.sqlite'):
107+
os.remove('dbostest.sqlite') # pragma: lax no cover
108+
109+
121110
@contextmanager
122111
def workflow_raises(exc_type: type[Exception], exc_message: str) -> Iterator[None]:
123112
"""Helper for asserting that a DBOS workflow fails with the expected error."""
@@ -129,8 +118,8 @@ def workflow_raises(exc_type: type[Exception], exc_message: str) -> Iterator[Non
129118

130119
DBOS_CONFIG: DBOSConfig = {
131120
'name': 'pydantic_dbos_tests',
132-
'database_url': DBOS_DATABASE_URL,
133-
'system_database_url': DBOS_DATABASE_URL,
121+
'database_url': 'sqlite:///dbostest.sqlite',
122+
'system_database_url': 'sqlite:///dbostest.sqlite',
134123
'run_admin_server': False,
135124
}
136125

uv.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)