Conversation
SeleniumTestCase moved to dedicated file seleniumtests.py Removed driver class variable Added support for multiple webdrivers
Make each app within adagios run it's own browser session. Initial work to allow for testing multiple browsers in the same run.
|
Please fix travis unittest before we can merge this pull request. |
|
Thanks. Looking cleaner now. The unit tests are not running on my machine. They fail with the error below and after the tests run port 8000 is occupied by nagios3 for some odd reason. Seems like somewhere instead of selenium starting django on port 8000, it starts a livestatus socket on that port. The tests are failing because firefox tries to open port 8000 but the page is hanging. $ python manage.py test ............/usr/lib/python2.7/dist-packages/django/http/response.py:330: DeprecationWarning: Using mimetype keyword argument is deprecated, use content_type instead ...E......E................................ERROR: setUpClass (adagios.status.tests.SeleniumStatusTestCase)Traceback (most recent call last): ERROR: setUpClass (adagios.objectbrowser.tests.SeleniumObjectBrowserTestCase)Traceback (most recent call last): Ran 62 tests in 107.764s FAILED (errors=2) |
If selenium initialization failed the fake adagios env would not be destroyed leaving nagios daemon processes hanging around.
Wrapped webdriver initialization in a try/except and skip if unable to initialize the webdriver in use. Running with "python manage.py test -v 2" will show the reason for skipping.
There was a problem hiding this comment.
Please also remove unneeded imports from this file.
|
I believe the issue you are having is a selenium/firefox communcations error, you can check http://stackoverflow.com/questions/6682009/selenium-firefoxprofile-exception-cant-load-the-profile for pointers. Regarding the port 8000 issue, here is whats really happening:
I managed to prove this with the following code: Running netstat before the python script exits After the 10 second sleep is done, netstat looks like this I'm pushing code where the FakeAdagiosEnvironment is not setup until the selenium webdriver has been initialized. |
|
@palli and I've removed all unused imports from utils.py. |
|
If unhandled exception in setUpClass is causing tearDown never to be called, then i think it makes since to wrap try/except around webdriver calls with its own cleanup. |
|
I don't think there is a need since I moved webdriver above the fake environment, therefore there is not nagios environment to tear down on selenium init failure. |
|
New light on this pull request, it seems like working versions of the firefox webdriver seems hard to come by without resulting to using pip, can you modify this pull request so that the tests are simply skipped if it fails to load the web driver ? If need be, you can create seperate unit tests for loading of the web driver, if you don't want to hide breakage in the loading code. |
|
Looks like skipping on webdriver error is already there (but overly broad imho, i.e. no need to skip inside travis). Good enough as is. Thanks for fixing the build! |
Make each app within adagios run it's own browser session.
Initial work to allow for testing multiple browsers in the same run.
Remove class variables and other changes suggested in #441