#2879: Add live test server support to test framework -------------------------------------+------------------------------------- Reporter: Mikeal Rogers | Owner: devin <mikeal@…> | Status: new Type: New feature | Version: Component: Testing framework | Resolution: Severity: Normal | Triage Stage: Accepted Keywords: | Needs documentation: 0 Has patch: 1 | Patch needs improvement: 1 Needs tests: 0 | UI/UX: 0 Easy pickings: 0 | -------------------------------------+-------------------------------------
Comment (by julien): Thanks, Tom, those tests are very useful! (By the way, there seems to be a problem with your latest patch as it didn't apply cleanly with 'git apply'. I had to use the 'patch -p1' command and then manually create the `live_server_tests/__init__.py` file) The process termination issue is a weird one. It seems to only occur with Python 2.7, as it works fine with Python 2.5&6. Also, adding `sleep(0.001)` at the end of `LiveServerTestCase.tearDown()` seems to fix it — although that wouldn't be acceptable as a solution :) Threads cannot easily share memory in Python. Pysqlite addresses that problem by setting the `check_same_thread` parameter to `False`: `sqlite.connect(":memory:", check_same_thread = False)` So, instead of recreating a new database in the separate thread, we should make sqlite share the same in-memory database by setting `DATABASES['default']['OPTIONS']['check_same_thread']` to False in `LiveServerTestCase.setUp()`. I haven't tested that yet. You can google 'check_same_thread' for more info — some people claim that it works and others that it doesn't. If no solution can be found then it looks like in- memory sqlite databases might not be supported by this approach. As for the media, it's unclear to me from looking at your patch what you're actually testing. Where are the "example_media_file.txt" and "example_file.txt" files supposed to be physically located and served from? -- Ticket URL: <https://code.djangoproject.com/ticket/2879#comment:79> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to django-updates@googlegroups.com. To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-updates?hl=en.