Skip to content

Commit 1e3f34b

Browse files
committed
formatting
1 parent 97b1949 commit 1e3f34b

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

tests/test_dbos.py

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -96,17 +96,6 @@ def uninstrument_pydantic_ai() -> Iterator[None]:
9696
Agent.instrument_all(False)
9797

9898

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-
11099
@contextmanager
111100
def workflow_raises(exc_type: type[Exception], exc_message: str) -> Iterator[None]:
112101
"""Helper for asserting that a DBOS workflow fails with the expected error."""
@@ -116,10 +105,11 @@ def workflow_raises(exc_type: type[Exception], exc_message: str) -> Iterator[Non
116105
assert str(exc_info.value) == exc_message
117106

118107

108+
DBOS_SQLITE_FILE = 'dbostest.sqlite'
119109
DBOS_CONFIG: DBOSConfig = {
120110
'name': 'pydantic_dbos_tests',
121-
'database_url': 'sqlite:///dbostest.sqlite',
122-
'system_database_url': 'sqlite:///dbostest.sqlite',
111+
'database_url': f'sqlite:///{DBOS_SQLITE_FILE}',
112+
'system_database_url': f'sqlite:///{DBOS_SQLITE_FILE}',
123113
'run_admin_server': False,
124114
}
125115

@@ -134,6 +124,17 @@ def dbos() -> Generator[DBOS, Any, None]:
134124
DBOS.destroy()
135125

136126

127+
# Automatically clean up old DBOS sqlite files
128+
@pytest.fixture(autouse=True, scope='module')
129+
def cleanup_test_sqlite_file() -> Iterator[None]:
130+
if os.path.exists(DBOS_SQLITE_FILE):
131+
os.remove(DBOS_SQLITE_FILE) # pragma: lax no cover
132+
yield
133+
134+
if os.path.exists(DBOS_SQLITE_FILE):
135+
os.remove(DBOS_SQLITE_FILE) # pragma: lax no cover
136+
137+
137138
model = OpenAIChatModel(
138139
'gpt-4o',
139140
provider=OpenAIProvider(

0 commit comments

Comments
 (0)