|
1 | 1 | # Py-PGlite |
2 | 2 |
|
3 | | -<div style="display: flex; align-items: flex-start;"> |
4 | | - <div style="flex: 0 0 auto; margin-right: 18px;"> |
5 | | - <img src="https://github.com/user-attachments/assets/3c6ef886-5075-4d82-a180-a6b1dafe792b" alt="py-pglite Logo" width="160" style="border-radius: 8px;"/> |
6 | | - </div> |
7 | | - <div style="flex: 1;"> |
8 | | - <p><strong>Instant PostgreSQL for Python testing</strong> ⚡</p> |
9 | | - <p><code>pip install py-pglite</code></p> |
10 | | - <pre><code class="language-python">def test_users(pglite_session): |
| 3 | +<img src="https://github.com/user-attachments/assets/3c6ef886-5075-4d82-a180-a6b1dafe792b" alt="py-pglite Logo" width="60" align="left" style="margin-right: 16px;"/> |
| 4 | + |
| 5 | +**Instant PostgreSQL for Python testing** ⚡ |
| 6 | + |
| 7 | +`pip install py-pglite` |
| 8 | + |
| 9 | +<br clear="all"/> |
| 10 | + |
| 11 | +```python |
| 12 | +def test_users(pglite_session): |
11 | 13 | user = User(name="Alice") |
12 | 14 | pglite_session.add(user) |
13 | 15 | pglite_session.commit() |
14 | | - assert user.id == 1 # It's real PostgreSQL!</code></pre> |
15 | | - <p><strong>That's it.</strong> No Docker, no setup, no config files. Real PostgreSQL, instant testing.</p> |
16 | | - </div> |
17 | | -</div> |
| 16 | + assert user.id == 1 # It's real PostgreSQL! |
| 17 | +``` |
18 | 18 |
|
19 | | -<br clear="all"/> |
| 19 | +**That's it.** No Docker, no setup, no config files. Real PostgreSQL, instant testing. |
20 | 20 |
|
21 | 21 | [](https://github.com/wey-gu/py-pglite/actions/workflows/ci.yml) [](https://badge.fury.io/py/py-pglite) [](https://pypi.org/project/py-pglite/) |
22 | 22 |
|
@@ -254,25 +254,21 @@ pytest tests/django/ # Auto-isolated |
254 | 254 | --- |
255 | 255 |
|
256 | 256 | <<<<<<< HEAD |
257 | | - |
258 | 257 | # Custom configuration |
259 | | - |
260 | 258 | config = PGliteConfig( |
261 | 259 | timeout=30, |
262 | 260 | cleanup_on_exit=True, |
263 | 261 | log_level="DEBUG" |
264 | 262 | ) |
265 | 263 |
|
266 | 264 | # Manual management |
267 | | - |
268 | 265 | with PGliteManager(config) as manager: |
269 | 266 | engine = manager.get_engine() |
270 | 267 | SQLModel.metadata.create_all(engine) |
271 | | - |
| 268 | + |
272 | 269 | with Session(engine) as session: |
273 | 270 | # Your database operations here |
274 | 271 | pass |
275 | | - |
276 | 272 | ``` |
277 | 273 |
|
278 | 274 | ## 🔧 Features |
@@ -478,7 +474,6 @@ def test_with_custom_cleanup(pglite_engine): |
478 | 474 | # Custom cleanup if needed |
479 | 475 | utils.clean_database_data(pglite_engine) |
480 | 476 | ``` |
481 | | - |
482 | 477 | ======= |
483 | 478 | *py-pglite: Because testing should be simple.* ⚡ |
484 | 479 | >>>>>>> 7555fb5 (feat & refactor: decouple sqlalchemy, introduce django & pytest-django) |
0 commit comments