@@ -113,59 +113,115 @@ make fmt # Auto-fix formatting
113113
114114## 📁 ** Project Structure**
115115
116- ```
116+ ``` bash
117117py-pglite/
118- ├── py_pglite/ # 📦 Core package
119- │ ├── __init__.py # Public API
120- │ ├── manager.py # PGlite management
121- │ ├── config.py # Configuration
122- │ ├── sqlalchemy/ # SQLAlchemy integration
123- │ ├── django/ # Django integration
124- │ └── pytest_plugin.py # Pytest plugin
118+ ├── py_pglite/ # 📦 Core package
119+ │ ├── __init__.py # Public API
120+ │ ├── manager.py # Framework-agnostic PGlite management
121+ │ ├── config.py # Robust configuration system
122+ │ ├── utils.py # Framework-agnostic utilities
123+ │ ├── sqlalchemy/ # SQLAlchemy integration
124+ │ │ ├── manager.py # Enhanced SQLAlchemy manager
125+ │ │ ├── fixtures.py # Pytest fixtures
126+ │ │ └── utils.py # SQLAlchemy utilities
127+ │ ├── django/ # Django integration
128+ │ │ ├── backend.py # Custom database backend
129+ │ │ ├── fixtures.py # Django fixtures
130+ │ │ └── utils.py # Django utilities
131+ │ └── pytest_plugin.py # Auto-discovery pytest plugin
125132│
126- ├── tests/ # 🧪 Core tests
127- │ ├── test_core_manager.py # Manager tests
128- │ ├── test_advanced.py # Advanced features
129- │ └── test_framework_isolation.py # Framework isolation
133+ ├── tests/ # 🧪 Core tests (88 tests)
134+ │ ├── test_core_manager.py # Manager lifecycle & process management
135+ │ ├── test_advanced.py # Advanced usage patterns
136+ │ ├── test_configuration.py # 🆕 Configuration validation & edge cases
137+ │ ├── test_connection_management.py # 🆕 Connection pooling & lifecycle
138+ │ ├── test_reliability.py # 🆕 Error recovery & resilience
139+ │ ├── test_django_backend.py # 🆕 Django backend & decoupling
140+ │ ├── test_fastapi_integration.py # FastAPI patterns
141+ │ └── test_framework_isolation.py # Framework isolation validation
130142│
131- ├── examples/ # 📚 Examples & demos
132- │ ├── quickstart/ # ⚡ Instant demos
133- │ └── testing-patterns/ # 🧪 Production examples
143+ ├── examples/ # 📚 Examples & demos (51 tests)
144+ │ ├── quickstart/ # ⚡ Instant demos
145+ │ │ ├── demo_instant.py # 5-line PostgreSQL demo
146+ │ │ ├── simple_fastapi.py # FastAPI integration
147+ │ │ └── simple_performance.py # Performance comparison
148+ │ └── testing-patterns/ # 🧪 Production examples
149+ │ ├── sqlalchemy/ # SQLAlchemy patterns (2 tests)
150+ │ ├── django/ # Django patterns (10 tests)
151+ │ └── test_fixtures_showcase.py # Advanced patterns (8 tests)
134152│
135- ├── scripts/ # 🔧 Development tools
136- │ └── dev.py # Unified development script
153+ ├── scripts/ # 🔧 Development tools
154+ │ └── dev.py # Unified development script
137155│
138- └── Makefile # 🎯 Convenience commands
156+ └── Makefile # 🎯 Convenience commands
139157```
140158
141159---
142160
143161## 🧪 ** Testing Strategy**
144162
145- ### ** Core Tests ** ( ` tests/ ` )
163+ ### ** Comprehensive Test Coverage (139 Total Tests) **
146164
147- - ** Manager lifecycle** - Start/stop, configuration
148- - ** Framework isolation** - SQLAlchemy/Django separation
149- - ** Advanced features** - Complex scenarios
150- - ** FastAPI integration** - REST API patterns
165+ ** Core Tests** (` tests/ ` - 88 tests)
151166
152- ### ** Example Tests** (` examples/ ` )
167+ - ** 🏗️ Manager lifecycle** (` test_core_manager.py ` ) - Process management, configuration
168+ - ** ⚙️ Configuration validation** (` test_configuration.py ` ) - Edge cases, validation, performance
169+ - ** 🔗 Connection management** (` test_connection_management.py ` ) - Pooling, lifecycle, concurrency
170+ - ** 🛡️ Reliability & recovery** (` test_reliability.py ` ) - Error handling, process recovery, edge cases
171+ - ** 🌟 Django backend** (` test_django_backend.py ` ) - Django integration, decoupling validation
172+ - ** 🚀 FastAPI integration** (` test_fastapi_integration.py ` ) - REST API patterns
173+ - ** 🔀 Framework isolation** (` test_framework_isolation.py ` ) - SQLAlchemy/Django separation
174+ - ** 💎 Advanced features** (` test_advanced.py ` ) - Complex scenarios, manual management
153175
154- - ** SQLAlchemy patterns** - Real ORM usage
155- - ** Django patterns** - Real Django models
156- - ** Quickstart demos** - User experience validation
176+ ** Example Tests** (` examples/ ` - 51 tests)
157177
158- ### ** Framework Isolation**
178+ - ** 🎯 SQLAlchemy patterns** (2 tests) - Real ORM usage, modern SQLAlchemy 2.0
179+ - ** ⭐ Django patterns** (10 tests) - Django ORM, pytest-django, advanced features
180+ - ** 🎪 Advanced patterns** (8 tests) - Performance, PostgreSQL features, transactions
181+ - ** ⚡ Quickstart validation** (31 tests) - User experience, FastAPI, utilities
182+
183+ ### ** Quality Assurance Features**
159184
160185``` bash
161- # Test SQLAlchemy alone
186+ # Framework isolation validation
187+ pytest -m sqlalchemy -p no:django # Pure SQLAlchemy (no Django bleeding)
188+ pytest -m django -p no:sqlalchemy # Pure Django (no SQLAlchemy bleeding)
189+
190+ # Comprehensive coverage areas
191+ pytest tests/test_configuration.py # Config validation & edge cases
192+ pytest tests/test_reliability.py # Error recovery & resilience
193+ pytest tests/test_connection_management.py # Connection pooling & cleanup
194+
195+ # Real-world scenario validation
196+ pytest examples/testing-patterns/ # Production usage patterns
197+ ```
198+
199+ ### ** Battle-Tested Scenarios**
200+
201+ Our test suite validates these critical scenarios:
202+
203+ - ✅ ** Process recovery** - Manager restart, cleanup, resource management
204+ - ✅ ** Connection storms** - Concurrent access, pool exhaustion, timeout handling
205+ - ✅ ** Memory stability** - Long-running suites, large datasets, cleanup validation
206+ - ✅ ** Unicode data** - International character sets, special characters
207+ - ✅ ** Framework decoupling** - Zero bleeding between SQLAlchemy/Django components
208+ - ✅ ** Configuration robustness** - Edge cases, validation, invalid inputs
209+ - ✅ ** Production patterns** - FastAPI + SQLAlchemy, Django models, complex queries
210+
211+ ### ** Framework Isolation Testing**
212+
213+ ``` bash
214+ # Test SQLAlchemy isolation
162215pytest examples/testing-patterns/sqlalchemy/ -p no:django
163216
164- # Test Django alone
165- pytest examples/testing-patterns/django/
217+ # Test Django isolation
218+ pytest examples/testing-patterns/django/ -p no:sqlalchemy
166219
167220# Test framework coexistence
168221pytest tests/test_framework_isolation.py
222+
223+ # Test decoupling fix
224+ pytest tests/test_django_backend.py::TestDjangoBackendDecoupling
169225```
170226
171227---
@@ -322,6 +378,24 @@ def test_users(pglite_session):
322378
323379## 🔧 ** Known Issues & Solutions**
324380
381+ ### ** Django Backend Decoupling (Fixed in v0.3.0+)**
382+
383+ ** Issue:** Django backend was calling ` manager.wait_for_ready() ` but the base ` PGliteManager ` only had ` wait_for_ready_basic() ` , causing framework coupling.
384+
385+ ** Cause:** Django integration was inadvertently depending on SQLAlchemy-specific methods, breaking the framework-agnostic design.
386+
387+ ** Solution:** Added ` wait_for_ready() ` method to base ` PGliteManager ` that delegates to ` wait_for_ready_basic() ` for API consistency.
388+
389+ ``` python
390+ # Now works perfectly across all frameworks
391+ def test_django_backend_ready (db ):
392+ # Django backend uses base manager with consistent API
393+ manager = get_pglite_manager()
394+ manager.wait_for_ready() # ✅ Works in both SQLAlchemy and Django
395+ ```
396+
397+ ** Validation:** Comprehensive Django backend tests added (` test_django_backend.py ` ) with 9 tests covering decoupling, imports, and error handling.
398+
325399### ** Connection Timeouts (Fixed in v0.2.0+)**
326400
327401** Issue:** ` psycopg.errors.ConnectionTimeout ` when creating tables or running DDL operations.
@@ -336,6 +410,26 @@ engine = manager.get_engine()
336410SQLModel.metadata.create_all(engine) # ✅ Works
337411```
338412
413+ ** Additional Improvements:**
414+
415+ - ** Connection pooling** - StaticPool and NullPool support with proper configuration
416+ - ** Timeout handling** - Configurable timeouts with robust retry logic
417+ - ** Process recovery** - Automatic cleanup and restart on failures
418+ - ** Resource management** - Comprehensive socket and memory cleanup
419+
420+ ### ** Framework Isolation (Enhanced in v0.3.0+)**
421+
422+ ** Validation:** py-pglite now has comprehensive framework isolation testing:
423+
424+ ``` bash
425+ # These work perfectly without interference
426+ pytest -m sqlalchemy -p no:django # Pure SQLAlchemy
427+ pytest -m django -p no:sqlalchemy # Pure Django
428+ pytest tests/test_framework_isolation.py # Validation suite
429+ ```
430+
431+ ** Coverage:** 139 total tests including edge cases, error recovery, and production scenarios.
432+
339433---
340434
341435## 🎉 ** Release Process**
0 commit comments