Repository navigation
Guide and skill django: the tests of the routes of Pyjoyment in manage.py test, with close_old_connections detached - #609
Merged
Merged
Conversation
…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>
Contributor
Tests
|
3 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The tests of the routes of Pyjoyment in front of a Django project, in
manage.py test.Changes
docs/guides/django/notes/tests.py: aTestCaseof Django withPyjo.Test.Pyjoof the application ofconfig/server.py, afterunittest.enterModuleContext(Pyjo.Test.raise_failures())and withenterClassContext(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,/readyzwith the check of the database, a static file, and the rollback between the tests. It detachesclose_old_connectionsfromrequest_startedandrequest_finishedfor its class, as the test client of Django does for its own requests: a request of Pyjoyment reaches theWSGIHandlerof 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 testof 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.django: its description, and the detached handlers in Mistakes.tests: a user agent of its own, withua.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 onPyjo.Reactor.Poll;Pyjo.Test.Pyjo, orioloop=Pyjo.IOLoop.singleton.The rest of the issue:
PYJO_REACTORbeforePyjo.IOLoopis not needed since Pyjo.App.WSGI: a synchronous WSGI application on the reactor of asyncio, with Pyjo.IOLoop.blocking #603, as Django runs on the default reactor.Pyjo.Test.Pyjo.TestCaseis not needed:enterModuleContextandenterClassContextof unittest do it (Pyjo.Test, Pyjo.Test.Pyjo: tests of unittest.TestCase, with raise_failures as a context manager that restores the mode #608).Validation
t/servers/Django.pyon Python 3.15 and 3.12, with the groupservers-W,trunk check,claude plugin validatePyjo.IOLoop.singletonagainst/readyzwith a check of a promise, on both reactorsCloses #567
🤖 Generated with Claude Code