Opened 8 years ago

Last modified 8 years ago

#27596 closed Bug

LiveServerTestCase in 1.10.4 doesnt close server ports properly — at Version 3

Reported by: Mike Hibbert Owned by: nobody
Component: Testing framework Version: 1.10
Severity: Normal Keywords:
Cc: Marten Kenbeek Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Tim Graham)

I get the following error when using LiveServerTestCase along with lettuce:

Traceback (most recent call last):
  File "./manage.py", line 22, in <module>
    execute_from_command_line(sys.argv)
  File "/home/mike/Documents/python/bdd_older/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 367, in execute_from_command_line
    utility.execute()
  File "/home/mike/Documents/python/bdd_older/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 359, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/mike/Documents/python/bdd_older/local/lib/python2.7/site-packages/django/core/management/base.py", line 294, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/home/mike/Documents/python/bdd_older/local/lib/python2.7/site-packages/django/core/management/base.py", line 345, in execute
    output = self.handle(*args, **options)
  File "/home/mike/Documents/python/bdd_older/src/lettuce/lettuce/django/management/commands/harvest.py", line 191, in handle
    server.start()
  File "/home/mike/Documents/python/bdd_older/src/lettuce/lettuce/django/server.py", line 350, in start
    LiveServerTestCase.setUpClass()
  File "/home/mike/Documents/python/bdd_older/local/lib/python2.7/site-packages/django/test/testcases.py", line 1353, in setUpClass
    raise cls.server_thread.error
socket.error: [Errno 98] Address already in use

To reproduce the bug I've attached my Django project that can be run.

The error occurs when you try to run the tests. The first time through it works fine but if you try and run the tests again with about 1 - 2mins it will give the error above.

When I downgrade to 1.9.4 this works fine without the error.

Here's my code to reproduce the bug, the upload restrictions stopped me adding an attachment but you can see my test case here ​https://www.dropbox.com/s/18uy88gz6frjyeg/bdd_app.tar.gz?dl=0

Change History (3)

comment:1 by Mike Hibbert, 8 years ago

The upload restrictions stopped me adding an attachment but you can see my test case here https://www.dropbox.com/s/18uy88gz6frjyeg/bdd_app.tar.gz?dl=0

comment:2 by Mike Hibbert, 8 years ago

Description: modified (diff)

comment:3 by Tim Graham, 8 years ago

Description: modified (diff)

Could you please bisect to find the commit where the behavior changed?

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