Generate unit test HTML reports

Currently we need to check unit test results by opening console.html.
HTML reports would be nice for this purpose.

Note that the infra CI post script stores '*nose_results.html',
so the filenames need to end with 'nose_results.html'.

--with-html-output option is not available for python 3. I am not sure
the reason at now, but I think it is worth enabling it for python 2.

Change-Id: Icea8d21d0cf93f99f577e6609e9ced166a55609a
This commit is contained in:
Akihiro Motoki 2017-05-04 06:59:27 +00:00
parent a799fd8721
commit 65951cf1b9
3 changed files with 15 additions and 0 deletions

1
.gitignore vendored
View File

@ -15,6 +15,7 @@
coverage.xml coverage.xml
coverage-karma coverage-karma
nosetests.xml nosetests.xml
*nose_results.html
pep8.txt pep8.txt
pylint.txt pylint.txt
# Files created by releasenotes build # Files created by releasenotes build

View File

@ -19,6 +19,8 @@
import os import os
import socket import socket
import six
from openstack_dashboard.utils import settings as settings_utils from openstack_dashboard.utils import settings as settings_utils
socket.setdefaulttimeout(1) socket.setdefaulttimeout(1)
@ -112,6 +114,11 @@ NOSE_ARGS = ['--nocapture',
'--cover-package=horizon', '--cover-package=horizon',
'--cover-inclusive', '--cover-inclusive',
'--all-modules'] '--all-modules']
# TODO(amotoki): Need to investigate why --with-html-output
# is unavailable in python3.
if six.PY2:
NOSE_ARGS += ['--with-html-output',
'--html-out-file=ut_horizon_nose_results.html']
EMAIL_BACKEND = 'django.core.mail.backends.locmem.EmailBackend' EMAIL_BACKEND = 'django.core.mail.backends.locmem.EmailBackend'
SESSION_ENGINE = 'django.contrib.sessions.backends.signed_cookies' SESSION_ENGINE = 'django.contrib.sessions.backends.signed_cookies'

View File

@ -13,6 +13,8 @@
import os import os
import tempfile import tempfile
import six
from django.utils.translation import pgettext_lazy from django.utils.translation import pgettext_lazy
from horizon.test.settings import * # noqa from horizon.test.settings import * # noqa
from horizon.utils import secret_key from horizon.utils import secret_key
@ -249,6 +251,11 @@ NOSE_ARGS = ['--nocapture',
'--cover-package=openstack_dashboard', '--cover-package=openstack_dashboard',
'--cover-inclusive', '--cover-inclusive',
'--all-modules'] '--all-modules']
# TODO(amotoki): Need to investigate why --with-html-output
# is unavailable in python3.
if six.PY2:
NOSE_ARGS += ['--with-html-output',
'--html-out-file=ut_openstack_dashboard_nose_results.html']
POLICY_FILES_PATH = os.path.join(ROOT_PATH, "conf") POLICY_FILES_PATH = os.path.join(ROOT_PATH, "conf")
POLICY_FILES = { POLICY_FILES = {