diff --git a/horizon/test/helpers.py b/horizon/test/helpers.py index 7ef98d0e15..1ae69e87d3 100644 --- a/horizon/test/helpers.py +++ b/horizon/test/helpers.py @@ -186,7 +186,7 @@ class JasmineTests(SeleniumTestCase): through Selenium To run a jasmine test suite create a class which extends JasmineTests in - the :file:`horizon/test/jasmine/jasmine.py` and define two classes + the :file:`horizon/test/jasmine/jasmine_tests.py` and define two class attributes .. attribute:: sources diff --git a/horizon/test/jasmine/jasmine.py b/horizon/test/jasmine/jasmine.py index 0938ab22a3..3d4d21c4df 100644 --- a/horizon/test/jasmine/jasmine.py +++ b/horizon/test/jasmine/jasmine.py @@ -14,13 +14,17 @@ import django.shortcuts import django.views.defaults -from horizon.test import helpers as test import inspect import sys def dispatcher(request, test_name): - classes = inspect.getmembers(sys.modules[__name__], inspect.isclass) + #import is included in this non-standard location to avoid + #problems importing mox. See bug/1288245 + from horizon.test.jasmine import jasmine_tests as tests + classes = inspect.getmembers(sys.modules[tests.__name__], + inspect.isclass) + if not test_name: return django.shortcuts.render( request, @@ -41,11 +45,3 @@ def dispatcher(request, test_name): {'specs': cls.specs, 'sources': cls.sources}) return django.views.defaults.page_not_found(request) - - -class ServicesTests(test.JasmineTests): - sources = [ - 'horizon/js/angular/horizon.conf.js', - 'horizon/js/angular/services/horizon.utils.js' - ] - specs = ['horizon/tests/jasmine/utilsSpec.js'] diff --git a/horizon/test/jasmine/jasmine_tests.py b/horizon/test/jasmine/jasmine_tests.py new file mode 100644 index 0000000000..4e2f69ac92 --- /dev/null +++ b/horizon/test/jasmine/jasmine_tests.py @@ -0,0 +1,21 @@ +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +from horizon.test import helpers as test + + +class ServicesTests(test.JasmineTests): + sources = [ + 'horizon/js/angular/horizon.conf.js', + 'horizon/js/angular/services/horizon.utils.js' + ] + specs = ['horizon/tests/jasmine/utilsSpec.js']