Forums

Hanging up when creating test db for myusername.pythonanywhere.com site

When I try to run my functional tests (that I wrote based on the TDD book), it gets hung up and never progresses. Which is weird because it used to work just fine.

I run the test with:

(django18)02:13 ~/development (master)$ xvfb-run -a python3.4 manage.py test functional_tests

It gets to:

Creating test database for alias 'default'...

And never gets past it. (Even if you let it run for an hour.) I commented most of the functional_test file to figure out where it was hanging up, and it's this line:

self.browser.get('http://larapsodia.pythonanywhere.com')

If I change that URL to my production site (http://www.tunisiandictionary.com) — or google.com or any other site — it doesn't get hung up. Only with the pythonanywhere address.

Like I said, it was working just fine yesterday or the day before, and I haven't changed anything on the site. (I might have tried to change some things but nothing that I kept.) My full code up to that point is below.

Any idea what's going on?

Thanks,

Karen

from django.test import LiveServerTestCase
from selenium import webdriver
from selenium.webdriver.common.keys import Keys

class NewVisitorTest(LiveServerTestCase):

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

    def tearDown(self):
        self.browser.quit()

    def test_page_displays(self):
        # Noelle just came across a Tunisian word that she
        # doesn't know. She goes to a new dictionary site
        # to find it
        self.browser.get('http://larapsodia.pythonanywhere.com')

Hi Karen!

I see you've got password protection switched on for the site, I wonder if that could be it? Try switching it off (do a reload webapp and then double-check manually that it really is off), and then re-running the FT?

I'll do a little testing of my own. If selenium just hangs when it sees an HTTP-auth prompt, then that's probably a bug we can report to the selenium devs...

Yep, looks like selenium hasn't got great support for HTTP-auth. There is a workaround, using the username:password@ syntax:

browser.get('http://username:password@www.mydomain.com/')

If you want to keep using HTTP-auth, you could try that?

That fixed it! Thanks!