Buckets:
| """ | |
| Pytest configuration and fixtures for Zenith tests. | |
| """ | |
| import warnings | |
| import pytest | |
| def suppress_sqlalchemy_gc_warnings(): | |
| """ | |
| Suppress SQLAlchemy GC cleanup warnings in test environment. | |
| These warnings occur because pytest-asyncio creates new event loops per test, | |
| and when the interpreter shuts down, the garbage collector finds connections | |
| that weren't explicitly closed. This doesn't affect production code where | |
| connections are properly managed through the application lifecycle. | |
| """ | |
| with warnings.catch_warnings(): | |
| warnings.filterwarnings( | |
| "ignore", | |
| message="The garbage collector is trying to clean up", | |
| category=Warning, | |
| ) | |
| yield | |
| def cleanup_sqlalchemy_on_exit(): | |
| """Ensure SQLAlchemy engines are disposed at session end.""" | |
| yield | |
| # Force garbage collection to clean up before interpreter shutdown | |
| # Skip on Python 3.14 due to segfault in greenlet GC interaction | |
| import sys | |
| if sys.version_info < (3, 14): | |
| import gc | |
| gc.collect() | |
Xet Storage Details
- Size:
- 1.16 kB
- Xet hash:
- 6e208edb7ecc15555ab322675f42e0c192d4359a5778f4b220effebab064e4aa
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.