Skip to content

Guide and skill django: the tests of the routes of Pyjoyment in manage.py test, with close_old_connections detached - #609

Merged
dex4er merged 1 commit into
mainfrom
django-tests
Nov 12, 2026
Merged

dex4er merged 1 commit into
mainfrom
django-tests

Conversation

@dex4er

@dex4er dex4er commented Nov 12, 2026

Copy link
Copy Markdown
Collaborator

The tests of the routes of Pyjoyment in front of a Django project, in manage.py test.

Changes

  • docs/guides/django/notes/tests.py: a TestCase of Django with Pyjo.Test.Pyjo of the application of config/server.py, after unittest.enterModuleContext(Pyjo.Test.raise_failures()) and with enterClassContext (Pyjo.Test, Pyjo.Test.Pyjo: tests of unittest.TestCase, with raise_failures as a context manager that restores the mode #608), which tests a view with a query, a POST, /livez, /readyz with the check of the database, a static file, and the rollback between the tests. It detaches close_old_connections from request_started and request_finished for its class, as the test client of Django does for its own requests: a request of Pyjoyment reaches the WSGIHandler of Django, and the check of the database sends the signals too, whose handler closes the connection of the transaction of the test, as it is not in the autocommit of the settings.
  • docs/guides/django.rst: a section Tests with it, and why the test database of SQLite in memory hides it, where one of PostgreSQL or of SQLite in a file shows it.
  • t/servers/Django.py: manage.py test of the guide on both reactors, with the test database in memory and in a file, and without the handlers detached, which fails with 500 of the view and 503 of /readyz.
  • Skill django: its description, and the detached handlers in Mistakes.
  • Skill tests: a user agent of its own, with ua.server.app = app, runs an event loop of its own, where a response that a promise of the application settles, as /readyz, does not come on Pyjo.Reactor.Poll; Pyjo.Test.Pyjo, or ioloop=Pyjo.IOLoop.singleton.

The rest of the issue:

Validation

  • t/servers/Django.py on Python 3.15 and 3.12, with the group servers
  • The tests of the skills, Sphinx with -W, trunk check, claude plugin validate
  • A user agent of its own and one of Pyjo.IOLoop.singleton against /readyz with a check of a promise, on both reactors

Closes #567

🤖 Generated with Claude Code

…e.py test, with close_old_connections detached

The guide project has notes/tests.py, a TestCase of Django with
Pyjo.Test.Pyjo of the application of config/server.py, which detaches
close_old_connections from request_started and request_finished for its
class, as the test client of Django does for its own requests: the handler
closes the connection of the transaction of the test, which a test database
of SQLite in memory hides. t/servers/Django.py runs it with manage.py test
on both reactors, with a test database in memory and in a file, and without
the handlers detached. The skill tests says that a user agent of its own runs
an event loop of its own, where a response that a promise of the application
settles does not come on Pyjo.Reactor.Poll.

Closes #567

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dex4er dex4er added this to the 0.4.0 milestone Nov 12, 2026
@read-the-docs-community

Copy link
Copy Markdown

Documentation build overview

📚 Pyjoyment | 🛠️ Build #35839842 | 📁 Comparing d9e2c1f against latest (312b482)

  🔍 Preview build  

1 file changed
± guides/django.html

@github-actions

Copy link
Copy Markdown
Contributor

Tests

Job Tests Passed ✅ Skipped ⚠️ Failed ❌ Log
prove (python 3.12, Asyncio) 7437 7408 29 0 ✅ 131217074376
prove (python 3.12, Poll) 7409 7378 31 0 ✅ 131217075213
prove (python 3.13, Asyncio) 7437 7408 29 0 ✅ 131217074369
prove (python 3.13, Poll) 7409 7378 31 0 ✅ 131217074184
prove (python 3.14, Asyncio) 7468 7444 24 0 ✅ 131217074463
prove (python 3.14, Poll) 7440 7414 26 0 ✅ 131217074635
prove (python 3.15, Asyncio) 7468 7444 24 0 ✅ 131217074234
prove (python 3.15, Poll) 7440 7414 26 0 ✅ 131217074676
prove (python 3.15t, Asyncio) 7468 7444 24 0 ✅ 131217074695
prove (python 3.15t, Poll) 7440 7414 26 0 ✅ 131217074298
prove (python mise, Asyncio) 7547 7512 35 0 ✅ 131217073816
prove (python mise, Asyncio, Windows) 7268 7202 66 0 ✅ 131217074162
prove (python mise, Poll) 7519 7482 37 0 ✅ 131217074206
prove (python mise, Poll, Windows) 7240 7172 68 0 ✅ 131217074248
prove (python pypy3.12, Asyncio) 7437 7408 29 0 ✅ 131217074375
prove (python pypy3.12, Poll) 7409 7378 31 0 ✅ 131217074578
pytest (python 3.12, ubuntu-26.04-arm) 439 413 26 0 ✅ 131217074220
pytest (python 3.15, ubuntu-26.04-arm) 439 418 21 0 ✅ 131217074297
pytest (python 3.15, windows-2025) 439 390 49 0 ✅ 131217074365
servers (python 3.12) 54 54 0 0 ✅ 131217074119
servers (python 3.15) 53 53 0 0 ✅ 131217074414
All 120260 119628 632 0 ✅

The run of the workflow

@dex4er
dex4er merged commit 8dfcc32 into main Nov 12, 2026
26 checks passed
@dex4er
dex4er deleted the django-tests branch November 12, 2026 13:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tests of Pyjo.Test.Pyjo in unittest.TestCase and the test runner of Django

1 participant