Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#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 Tim Graham, 12 years ago

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'...

comment:2 by Claude Paroz, 12 years ago

Has patch: unset
Triage Stage: UnreviewedAccepted

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 Tim Graham <timograham@…>, 12 years ago

Resolution: fixed
Status: newclosed

In a1a5c0854f0b0d3c94a772c8b994ee2d1d2f9be1:

Fixed #19051 - Fixed Selenium tearDownClass method; thanks glarrain for the report.

comment:4 by Tim Graham <timograham@…>, 12 years ago

In a35d7fd1e1c8e2a1e95b6d16949f9fb3977f15cb:

[1.4.X] Fixed #19051 - Fixed Selenium tearDownClass method; thanks glarrain for the report.

Backport of a1a5c0854f from master

Note: See TracTickets for help on using tickets.
Back to Top