diff --git a/CHANGELOG.md b/CHANGELOG.md index e9ad638..efd5912 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,20 +17,19 @@ Please see [MIGRATING.md](./MIGRATING.md) for information on breaking changes. ### Removed +## [3.1.4] - September 2025 -## [3.1.3] - September 2025 +### Fixed +- Fixed `connect_db` method return value for default :memory: connections +- Fixed flaky end to end test for source records in the snapshot environment -### Added +## [3.1.3] - September 2025 ### Fixed - Fixed multiple sequential newline characters in srs download - Fixed edge cases around non-default sorts and pagination - Unexposed an accidentally exposed internal module -### Changed - -### Removed - ## [3.1.2] - August 2025 ### Fixed diff --git a/pyproject.toml b/pyproject.toml index 876a957..3b10813 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "pdm.backend" [project] name = "ldlite" -version = "3.1.3" +version = "3.1.4" description = "Lightweight analytics tool for FOLIO services" authors = [ {name = "Katherine Bargar", email = "kbargar@fivecolleges.edu"}, diff --git a/src/ldlite/__init__.py b/src/ldlite/__init__.py index 10682c8..d1b8dc2 100644 --- a/src/ldlite/__init__.py +++ b/src/ldlite/__init__.py @@ -122,7 +122,7 @@ def _connect_db_duckdb( self.dbtype = DBType.DUCKDB fn = filename if filename is not None else ":memory:" db = duckdb.connect(database=fn) - self.db = cast("dbapi.DBAPIConnection", duckdb.connect(database=fn)) + self.db = cast("dbapi.DBAPIConnection", db) return db def connect_db_postgresql(self, dsn: str) -> psycopg2.extensions.connection: diff --git a/tests/test_endtoend.py b/tests/test_endtoend.py index 8c762ad..6bd6951 100644 --- a/tests/test_endtoend.py +++ b/tests/test_endtoend.py @@ -1,7 +1,6 @@ from dataclasses import astuple from typing import cast -import duckdb import pytest from httpx_folio.factories import FolioParams, default_client_factory from httpx_folio.query import QueryParams, QueryType @@ -33,7 +32,7 @@ def test_endtoend( from ldlite import LDLite as uut ld = uut() - ld.connect_db(":memory:shared") + db = ld.connect_db() ld.page_size = 3 ld.connect_folio(*astuple(folio_params[1])) @@ -49,7 +48,6 @@ def test_endtoend( expected = res.json()["totalRecords"] assert expected > 3 - db = duckdb.connect(":memory:shared") db.execute("SELECT COUNT(DISTINCT COLUMNS(*)) FROM test__t;") actual = cast("tuple[int]", db.fetchone())[0] @@ -60,14 +58,17 @@ def test_endtoend_srs(folio_params: tuple[bool, FolioParams]) -> None: from ldlite import LDLite as uut ld = uut() - ld.connect_db(":memory:shared") + db = ld.connect_db() ld.connect_folio(*astuple(folio_params[1])) - ld.query(table="test", path="/source-storage/source-records", limit=4) + ld.query(table="test", path="/source-storage/source-records", limit=10) - db = duckdb.connect(":memory:shared") db.execute("SELECT COUNT(DISTINCT COLUMNS(*)) FROM test__t;") actual = cast("tuple[int]", db.fetchone())[0] - # snapshot only has 4 records - assert actual == 4 + # snapshot a variable number of records + assert actual >= 1 + if folio_params[0]: + assert actual <= 10 + else: + assert actual == 10