hjwp/Test-Driven-Django-Tutorial

Unable to start the tests, cant find the problem.

mustafatulu opened this issue · 3 comments

Hi,
I am a newbie, and seem unable to fix this problem. In tutorial step 1, where we expect to run the setup fixture:

def setUp(self):
self.browser = webdriver.Firefox()
self.browser.implicitly_wait(3)

my python environment somehow gives the error:

File "C:\Users\PC\PythonVirtualEnvironment\lib\site-packages\django\test\testcases.py", line 1135, in setUpClass
raise cls.server_thread.error
WSGIServerException: [Errno 10013] An attempt was made to access a socket in a way forbidden by its access permissions

Where might be the problem?

hjwp commented

It looks like a problem starting up the django server in LiveServerTestCase, and it's complaining about permissions on the port.

One possibility is that you've accidentally tried to open up the test server twice - could there be an old manage.py test process running in the background? Have you tried rebooting?

Another possibility is that windows has something else running on the default port, which I believe is 8081. You can try running the server on a different port using, eg:

./manage.py test --liveserver=localhost:8082

https://docs.djangoproject.com/en/1.4/topics/testing/#django.test.LiveServerTestCase

./manage.py test --liveserver=localhost:8082
Did the trick. Thanks a lot.

On Sat, Jan 5, 2013 at 6:43 PM, Harry Percival notifications@github.comwrote:

It looks like a problem starting up the django server in
LiveServerTestCase, and it's complaining about permissions on the port.

One possibility is that you've accidentally tried to open up the test
server twice - could there be an old manage.py test process running in the
background? Have you tried rebooting?

Another possibility is that windows has something else running on the
default port, which I believe is 8081. You can try running the server on a
different port using, eg:

./manage.py test --liveserver=localhost:8082

https://docs.djangoproject.com/en/1.4/topics/testing/#django.test.LiveServerTestCase


Reply to this email directly or view it on GitHubhttps://github.com//issues/26#issuecomment-11916132.

hjwp commented

You're welcome!