Skip to content

Commit 969f95e

Browse files
fix test
1 parent e803723 commit 969f95e

File tree

1 file changed

+25
-24
lines changed

1 file changed

+25
-24
lines changed

tests/test_db_only_mode.py

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,31 @@ def __exit__(self, exc_type, exc_value, exc_traceback):
3434
self.connection.close()
3535

3636

37+
@pytest.mark.skipif(not DB_DEPENDENCIES, reason="Requires dependencies")
38+
class TestSQLLITE:
39+
def test_manager_can_be_built_without_exception(self, schema_file_path_sqlite):
40+
41+
with NamedTemporaryFile() as f:
42+
sqllite_url = f"sqlite:///{f.name}"
43+
config_dict = {
44+
"project_name": "test",
45+
"record_identifier": "sample1",
46+
"schema_path": schema_file_path_sqlite,
47+
"database": {"sqlite_url": f.name},
48+
}
49+
50+
with ContextManagerDBTesting(sqllite_url):
51+
try:
52+
SamplePipestatManager(
53+
schema_path=schema_file_path_sqlite,
54+
record_identifier="irrelevant",
55+
database_only=True,
56+
config_dict=config_dict,
57+
)
58+
except Exception as e:
59+
pytest.fail(f"Pipestat manager construction failed: {e})")
60+
61+
3762
@pytest.mark.skipif(not DB_DEPENDENCIES, reason="Requires dependencies")
3863
@pytest.mark.skipif(SERVICE_UNAVAILABLE, reason="requires service X to be available")
3964
class TestDatabaseOnly:
@@ -134,27 +159,3 @@ def test_select_pagination(
134159
result = psm.select_records(cursor=offset, limit=limit)
135160
print(result)
136161
assert len(result["records"]) == min(max((psm.record_count - offset), 0), limit)
137-
138-
139-
class TestSQLLITE:
140-
def test_manager_can_be_built_without_exception(self, schema_file_path_sqlite):
141-
142-
with NamedTemporaryFile() as f:
143-
sqllite_url = f"sqlite:///{f.name}"
144-
config_dict = {
145-
"project_name": "test",
146-
"record_identifier": "sample1",
147-
"schema_path": "sample_output_schema_sqlite.yaml",
148-
"database": {"sqlite_url": f.name},
149-
}
150-
151-
with ContextManagerDBTesting(sqllite_url):
152-
try:
153-
SamplePipestatManager(
154-
schema_path=schema_file_path_sqlite,
155-
record_identifier="irrelevant",
156-
database_only=True,
157-
config_dict=config_dict,
158-
)
159-
except Exception as e:
160-
pytest.fail(f"Pipestat manager construction failed: {e})")

0 commit comments

Comments
 (0)