Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
donaldcampbelljr committed Jul 18, 2024
1 parent e803723 commit 969f95e
Showing 1 changed file with 25 additions and 24 deletions.
49 changes: 25 additions & 24 deletions tests/test_db_only_mode.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,31 @@ def __exit__(self, exc_type, exc_value, exc_traceback):
self.connection.close()


@pytest.mark.skipif(not DB_DEPENDENCIES, reason="Requires dependencies")
class TestSQLLITE:
def test_manager_can_be_built_without_exception(self, schema_file_path_sqlite):

with NamedTemporaryFile() as f:
sqllite_url = f"sqlite:///{f.name}"
config_dict = {
"project_name": "test",
"record_identifier": "sample1",
"schema_path": schema_file_path_sqlite,
"database": {"sqlite_url": f.name},
}

with ContextManagerDBTesting(sqllite_url):
try:
SamplePipestatManager(
schema_path=schema_file_path_sqlite,
record_identifier="irrelevant",
database_only=True,
config_dict=config_dict,
)
except Exception as e:
pytest.fail(f"Pipestat manager construction failed: {e})")


@pytest.mark.skipif(not DB_DEPENDENCIES, reason="Requires dependencies")
@pytest.mark.skipif(SERVICE_UNAVAILABLE, reason="requires service X to be available")
class TestDatabaseOnly:
Expand Down Expand Up @@ -134,27 +159,3 @@ def test_select_pagination(
result = psm.select_records(cursor=offset, limit=limit)
print(result)
assert len(result["records"]) == min(max((psm.record_count - offset), 0), limit)


class TestSQLLITE:
def test_manager_can_be_built_without_exception(self, schema_file_path_sqlite):

with NamedTemporaryFile() as f:
sqllite_url = f"sqlite:///{f.name}"
config_dict = {
"project_name": "test",
"record_identifier": "sample1",
"schema_path": "sample_output_schema_sqlite.yaml",
"database": {"sqlite_url": f.name},
}

with ContextManagerDBTesting(sqllite_url):
try:
SamplePipestatManager(
schema_path=schema_file_path_sqlite,
record_identifier="irrelevant",
database_only=True,
config_dict=config_dict,
)
except Exception as e:
pytest.fail(f"Pipestat manager construction failed: {e})")

0 comments on commit 969f95e

Please sign in to comment.