Closed
Bug 888922
Opened 12 years ago
Closed 12 years ago
kitsune.sumo.tests.test_ui:TestLanguageSwitch.test_english_to_spanish fails
Categories
(support.mozilla.org :: Code Quality, task)
support.mozilla.org
Code Quality
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: willkg, Unassigned)
References
Details
The kitsune.sumo.tests.test_ui:TestLanguageSwitch.test_english_to_spanish test fails for me every time.
There's no documentation about how to set things up for these tests, so it's possible I don't have something set up right.
Here's the test run output:
(kitsune) (questions-885309=a6816) saturn ~/mozilla/kitsune> ./run_tests.sh kitsune.sumo.tests.test_ui:TestLanguageSwitch.test_english_to_spanish
nosetests --verbosity 1 kitsune.sumo.tests.test_ui:TestLanguageSwitch.test_english_to_spanish --nocapture --logging-clear-handlers --with-progressive --progressive-advisories -s
Reusing old database "test_kitsune". Set env var FORCE_DB=1 if you need fresh DBs.
Traceback (most recent call last):
File "/usr/lib/python2.7/wsgiref/handlers.py", line 85, in run
self.result = application(self.environ, self.start_response)
File "/home/willkg/mozilla/kitsune/vendor/src/django/django/contrib/staticfiles/handlers.py", line 67, in __call__
return self.application(environ, start_response)
File "/home/willkg/mozilla/kitsune/vendor/src/django/django/contrib/staticfiles/handlers.py", line 67, in __call__
return self.application(environ, start_response)
File "/home/willkg/mozilla/kitsune/vendor/src/django/django/core/handlers/wsgi.py", line 241, in __call__
response = self.get_response(request)
File "/home/willkg/mozilla/kitsune/vendor/src/django/django/core/handlers/base.py", line 179, in get_response
response = self.handle_uncaught_exception(request, resolver, sys.exc_info())
File "/home/willkg/mozilla/kitsune/vendor/src/django/django/core/handlers/base.py", line 228, in handle_uncaught_exception
return callback(request, **param_dict)
File "/home/willkg/mozilla/kitsune/kitsune/sumo/views.py", line 65, in handle500
return render(request, 'handlers/500.html', status=500)
File "/home/willkg/mozilla/kitsune/vendor/src/django/django/shortcuts/__init__.py", line 44, in render
return HttpResponse(loader.render_to_string(*args, **kwargs),
File "/home/willkg/mozilla/kitsune/vendor/src/django/django/template/loader.py", line 176, in render_to_string
return t.render(context_instance)
File "/home/willkg/mozilla/kitsune/vendor/src/jingo/jingo/__init__.py", line 193, in render
return super(Template, self).render(context_dict)
File "/home/willkg/.virtualenvs/kitsune/local/lib/python2.7/site-packages/jinja2/environment.py", line 891, in render
return self.environment.handle_exception(exc_info, True)
File "/home/willkg/mozilla/kitsune/kitsune/sumo/templates/handlers/500.html", line 2, in top-level template code
{% set title = _('An Error Occurred') %}
File "/home/willkg/mozilla/kitsune/kitsune/sumo/templates/base.html", line 28, in top-level template code
{{ css('common') }}
File "/home/willkg/mozilla/kitsune/vendor/src/jingo-minify/jingo_minify/helpers.py", line 137, in css
compile_css(item)
File "/home/willkg/mozilla/kitsune/vendor/src/jingo-minify/jingo_minify/helpers.py", line 169, in compile_css
updated_src = os.path.getmtime(get_path(item))
File "/home/willkg/.virtualenvs/kitsune/lib/python2.7/genericpath.py", line 54, in getmtime
return os.stat(filename).st_mtime
OSError: [Errno 2] No such file or directory: '/home/willkg/mozilla/kitsune/static/less/main.less'
ERROR: kitsune.sumo.tests.test_ui:TestLanguageSwitch.test_english_to_spanish
vim +14 kitsune/sumo/tests/test_ui.py # test_english_to_spanish
picker = self.webdriver.find_element_by_css_selector('.locale-picker')
vim +366 vendor/packages/selenium/py/selenium/webdriver/remote/webdriver.py # find_element_by_css_selector
return self.find_element(by=By.CSS_SELECTOR, value=css_selector)
vim +680 vendor/packages/selenium/py/selenium/webdriver/remote/webdriver.py # find_element
{'using': by, 'value': value})['value']
vim +165 vendor/packages/selenium/py/selenium/webdriver/remote/webdriver.py # execute
self.error_handler.check_response(response)
vim +158 vendor/packages/selenium/py/selenium/webdriver/remote/errorhandler.py # check_response
raise exception_class(message, screen, stacktrace)
NoSuchElementException: Message: 'Message: u\'Unable to locate element: {"method":"css selector","selector":".locale-picker"}\' ; Stacktrace: \n at FirefoxDriver.prototype.findElementInternal_ (file:///tmp/tmpq_fcwN/extensions/fxdriver@googlecode.com/components/driver_component.js:8444)\n at FirefoxDriver.prototype.findElement (file:///tmp/tmpq_fcwN/extensions/fxdriver@googlecode.com/components/driver_component.js:8453)\n at DelayedCommand.prototype.executeInternal_/h (file:///tmp/tmpq_fcwN/extensions/fxdriver@googlecode.com/components/command_processor.js:10456)\n at DelayedCommand.prototype.executeInternal_ (file:///tmp/tmpq_fcwN/extensions/fxdriver@googlecode.com/components/command_processor.js:10461)\n at DelayedCommand.prototype.execute/< (file:///tmp/tmpq_fcwN/extensions/fxdriver@googlecode.com/components/command_processor.js:10401) \n-------------------- >> begin captured logging << --------------------\nselenium.webdriver.remote.remote_connection: DEBUG: POST http://127.0.0.1:35828/hub/session {"sessionId": null, "desiredCapabilities": {"platform": "ANY", "browserName": "firefox", "version": "", "javascriptEnabled": true}}\nselenium.webdriver.remote.remote_connection: DEBUG: POST http://127.0.0.1:35828/hub/session/ce4c5fb9-f391-4537-bd05-07ea2e65399d/url {"url": "", "sessionId": "ce4c5fb9-f391-4537-bd05-07ea2e65399d"}\nselenium.webdriver.remote.remote_connection: DEBUG: POST http://127.0.0.1:35828/hub/session/ce4c5fb9-f391-4537-bd05-07ea2e65399d/url {"url": "http://localhost:8081/en-US/home", "sessionId": "ce4c5fb9-f391-4537-bd05-07ea2e65399d"}\ndjango.request: ERROR: Internal Server Error: /en-US/home\nTraceback (most recent call last):\n File "/home/willkg/mozilla/kitsune/vendor/src/django/django/core/handlers/base.py", line 111, in get_response\n response = callback(request, *callback_args, **callback_kwargs)\n File "/home/willkg/mozilla/kitsune/kitsune/landings/views.py", line 37, in home\n \'moz_news\': moz_news})\n File "/home/willkg/mozilla/kitsune/vendor/src/django/django/shortcuts/__init__.py", line 44, in render\n return HttpResponse(loader.render_to_string(*args, **kwargs),\n File "/home/willkg/mozilla/kitsune/vendor/src/django/django/template/loader.py", line 176, in render_to_string\n return t.render(context_instance)\n File "/home/willkg/mozilla/kitsune/vendor/src/jingo/jingo/__init__.py", line 193, in render\n return super(Template, self).render(context_dict)\n File "/home/willkg/.virtualenvs/kitsune/local/lib/python2.7/site-packages/jinja2/environment.py", line 891, in render\n return self.environment.handle_exception(exc_info, True)\n File "/home/willkg/mozilla/kitsune/kitsune/landings/templates/landings/home.html", line 3, in top-level template code\n {% set styles = (\'home\',) %}\n File "/home/willkg/mozilla/kitsune/kitsune/sumo/templates/base.html", line 28, in top-level template code\n {{ css(\'common\') }}\n File "/home/willkg/mozilla/kitsune/vendor/src/jingo-minify/jingo_minify/helpers.py", line 137, in css\n compile_css(item)\n File "/home/willkg/mozilla/kitsune/vendor/src/jingo-minify/jingo_minify/helpers.py", line 169, in compile_css\n updated_src = os.path.getmtime(get_path(item))\n File "/home/willkg/.virtualenvs/kitsune/lib/python2.7/genericpath.py", line 54, in getmtime\n return os.stat(filename).st_mtime\nOSError: [Errno 2] No such file or directory: \'/home/willkg/mozilla/kitsune/static/less/main.less\'\nselenium.webdriver.remote.remote_connection: DEBUG: POST http://127.0.0.1:35828/hub/session/ce4c5fb9-f391-4537-bd05-07ea2e65399d/element {"using": "css selector", "sessionId": "ce4c5fb9-f391-4537-bd05-07ea2e65399d", "value": ".locale-picker"}\ndjango.request: WARNING: Not Found: /favicon.ico\n--------------------- >> end captured logging << ---------------------'
Traceback (most recent call last):
File "/usr/lib/python2.7/wsgiref/handlers.py", line 85, in run
self.result = application(self.environ, self.start_response)
File "/home/willkg/mozilla/kitsune/vendor/src/django/django/contrib/staticfiles/handlers.py", line 67, in __call__
return self.application(environ, start_response)
File "/home/willkg/mozilla/kitsune/vendor/src/django/django/contrib/staticfiles/handlers.py", line 67, in __call__
return self.application(environ, start_response)
File "/home/willkg/mozilla/kitsune/vendor/src/django/django/core/handlers/wsgi.py", line 241, in __call__
response = self.get_response(request)
File "/home/willkg/mozilla/kitsune/vendor/src/django/django/core/handlers/base.py", line 153, in get_response
response = self.handle_uncaught_exception(request, resolver, sys.exc_info())
File "/home/willkg/mozilla/kitsune/vendor/src/django/django/core/handlers/base.py", line 228, in handle_uncaught_exception
return callback(request, **param_dict)
File "/home/willkg/mozilla/kitsune/kitsune/sumo/views.py", line 65, in handle500
return render(request, 'handlers/500.html', status=500)
File "/home/willkg/mozilla/kitsune/vendor/src/django/django/shortcuts/__init__.py", line 44, in render
return HttpResponse(loader.render_to_string(*args, **kwargs),
File "/home/willkg/mozilla/kitsune/vendor/src/django/django/template/loader.py", line 176, in render_to_string
return t.render(context_instance)
File "/home/willkg/mozilla/kitsune/vendor/src/jingo/jingo/__init__.py", line 193, in render
return super(Template, self).render(context_dict)
File "/home/willkg/.virtualenvs/kitsune/local/lib/python2.7/site-packages/jinja2/environment.py", line 891, in render
return self.environment.handle_exception(exc_info, True)
File "/home/willkg/mozilla/kitsune/kitsune/sumo/templates/handlers/500.html", line 2, in top-level template code
{% set title = _('An Error Occurred') %}
File "/home/willkg/mozilla/kitsune/kitsune/sumo/templates/base.html", line 28, in top-level template code
{{ css('common') }}
File "/home/willkg/mozilla/kitsune/vendor/src/jingo-minify/jingo_minify/helpers.py", line 137, in css
compile_css(item)
File "/home/willkg/mozilla/kitsune/vendor/src/jingo-minify/jingo_minify/helpers.py", line 169, in compile_css
updated_src = os.path.getmtime(get_path(item))
File "/home/willkg/.virtualenvs/kitsune/lib/python2.7/genericpath.py", line 54, in getmtime
return os.stat(filename).st_mtime
OSError: [Errno 2] No such file or directory: '/home/willkg/mozilla/kitsune/static/less/main.less'
----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 34292)
Traceback (most recent call last):
File "/home/willkg/mozilla/kitsune/vendor/src/django/django/test/testcases.py", line 984, in _handle_request_noblock
self.process_request(request, client_address)
File "/usr/lib/python2.7/SocketServer.py", line 321, in process_request
self.finish_request(request, client_address)
File "/usr/lib/python2.7/SocketServer.py", line 334, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/home/willkg/mozilla/kitsune/vendor/src/django/django/core/servers/basehttp.py", line 139, in __init__
super(WSGIRequestHandler, self).__init__(*args, **kwargs)
File "/usr/lib/python2.7/SocketServer.py", line 651, in __init__
self.finish()
File "/usr/lib/python2.7/SocketServer.py", line 710, in finish
self.wfile.close()
File "/usr/lib/python2.7/socket.py", line 279, in close
self.flush()
File "/usr/lib/python2.7/socket.py", line 303, in flush
self._sock.sendall(view[write_offset:write_offset+buffer_size])
error: [Errno 32] Broken pipe
----------------------------------------
1 test, 0 failures, 1 error in 9.5s
real 0m12.263s
user 0m5.484s
sys 0m0.936s
| Reporter | ||
Comment 1•12 years ago
|
||
I get the above when running that test in isolation. If I run the tests with all the other tests, I get a different error:
FAIL: kitsune.sumo.tests.test_ui:TestLanguageSwitch.test_english_to_spanish
vim +15 kitsune/sumo/tests/test_ui.py # test_english_to_spanish
eq_(picker.text, 'ENGLISH')
vim +31 vendor/packages/nose/nose/tools.py # eq_
assert a == b, msg or "%r != %r" % (a, b)
AssertionError: u'English' != 'ENGLISH'
-------------------- >> begin captured logging << --------------------
selenium.webdriver.remote.remote_connection: DEBUG: POST http://127.0.0.1:49752/hub/session {"sessionId": null, "desiredCapabilities": {"platform": "ANY", "browserName": "firefox", "version": "", "javascriptEnabled": true}}
selenium.webdriver.remote.remote_connection: DEBUG: POST http://127.0.0.1:49752/hub/session/a7712309-f22c-4f50-afae-1aefe0d814f5/url {"url": "", "sessionId": "a7712309-f22c-4f50-afae-1aefe0d814f5"}
selenium.webdriver.remote.remote_connection: DEBUG: POST http://127.0.0.1:49752/hub/session/a7712309-f22c-4f50-afae-1aefe0d814f5/url {"url": "http://localhost:8081/en-US/home", "sessionId": "a7712309-f22c-4f50-afae-1aefe0d814f5"}
django.request: WARNING: Not Found: /en-US/static/css/common-min.css
django.request: WARNING: Not Found: /en-US/static/css/print-min.css
django.request: WARNING: Not Found: /en-US/static/css/home-min.css
django.request: WARNING: Not Found: /en-US/static/js/common-min.js
django.request: WARNING: Not Found: /en-US/static/js/common-min.js
selenium.webdriver.remote.remote_connection: DEBUG: POST http://127.0.0.1:49752/hub/session/a7712309-f22c-4f50-afae-1aefe0d814f5/element {"using": "css selector", "sessionId": "a7712309-f22c-4f50-afae-1aefe0d814f5", "value": ".locale-picker"}
selenium.webdriver.remote.remote_connection: DEBUG: GET http://127.0.0.1:49752/hub/session/a7712309-f22c-4f50-afae-1aefe0d814f5/element/{fa52544c-07c1-4abd-8699-f867b990f840}/text {"sessionId": "a7712309-f22c-4f50-afae-1aefe0d814f5", "id": "{fa52544c-07c1-4abd-8699-f867b990f840}"}
--------------------- >> end captured logging << ---------------------
I don't know if the two issues are related. If not, then it might be worth bumping the second to a separate bug.
| Reporter | ||
Comment 2•12 years ago
|
||
I'm not getting the assertion error in comment #1 anymore. I'm going to file a second bug about the ui test failing since it's different than the description in this one.
| Reporter | ||
Comment 4•12 years ago
|
||
Mike figured it out. The problem is that the LiveServerTestCase tests kick off a Django server with DEBUG=False and running the staticfiles thing. So all static files are served from static/.
Because of that, you need to run collectstatic and compress_assets before running the tests. Otherwise those files are missing or stale.
I updated the documentation in https://github.com/mozilla/kitsune/commit/78529aec5e00b8211e14d079c2d51505d5461753
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•