#19051 closed Bug (fixed)
Error in testing/live-test-server example
| Reported by: | German Larrain | Owned by: | nobody |
|---|---|---|---|
| Component: | Documentation | Version: | 1.4 |
| Severity: | Normal | Keywords: | |
| Cc: | Triage Stage: | Accepted | |
| Has patch: | no | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
https://docs.djangoproject.com/en/1.4/topics/testing/#live-test-server
In
MySeleniumTests.tearDownClass
this
cls.selenium.quit()
must appear before calling
super(MySeleniumTests, cls).tearDownClass()
Otherwise the test will fail with the following message: "RuntimeError: Failed to shutdown the live test server in 2 seconds. The server might be stuck or generating a slow response."
Change History (4)
comment:1 by , 13 years ago
comment:2 by , 13 years ago
| Has patch: | unset |
|---|---|
| Triage Stage: | Unreviewed → Accepted |
On my system, ordering of those lines can be swapped without failures, so it may be system dependent (tested with selenium 2.20 and 2.25). But it makes sense to quit selenium before trying to kill the thread, so +1 for the change (both in docs and in AdminSeleniumWebDriverTestCase).
comment:3 by , 13 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
I can reproduce this error and confirm the suggested resolution fixes it by running Django's test suite. Could another core dev +1 to make sure I'm not missing something?
$ ./runtests.py --settings=test_sqlite admin_inlines Creating test database for alias 'default'... Creating test database for alias 'other'... s.....Es............................ ====================================================================== ERROR: tearDownClass (regressiontests.admin_inlines.tests.SeleniumFirefoxTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/timgraham/code/django/django/contrib/admin/tests.py", line 24, in tearDownClass super(AdminSeleniumWebDriverTestCase, cls).tearDownClass() File "/home/timgraham/code/django/django/test/testcases.py", line 1174, in tearDownClass cls.server_thread.join() File "/home/timgraham/code/django/django/test/testcases.py", line 1098, in join self.httpd.shutdown() File "/home/timgraham/code/django/django/test/testcases.py", line 989, in shutdown "Failed to shutdown the live test server in 2 seconds. The " RuntimeError: Failed to shutdown the live test server in 2 seconds. The server might be stuck or generating a slow response. ---------------------------------------------------------------------- Ran 33 tests in 19.540s FAILED (errors=1, skipped=2) Destroying test database for alias 'default'... Destroying test database for alias 'other'...