Changes test invocation from `manage.py test` to `pytest`. Adds addtitional
test requirements like pytest, pytest-django, pytest-html. Adds
`pytest.mark` alongside django's test `tag`. Adds posibility to export test
results into xml and html formats.
Depends-On: https://review.opendev.org/#/c/712315/
Related-Bug: #1866666
Co-Authored-By: Ivan Kolodyazhny <e0ne@e0ne.info>
Change-Id: Idb6e63cd23ca2ba8ca56f36eb8b63069bd211944
Now that we no longer support py27, we can use the standard library
unittest.mock module instead of the third party mock lib.
Change-Id: I2de669d8e89b8daeb7ee5405ffab35af6307c40b
This completes Mox removal from Horizon.
Change-Id: I73f7a01b7f655f7c1d0ba704f4417d6fe798a7eb
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Co-Authored-By: Akihiro Motoki <amotoki@gmail.com>
The goal definition in the TC repo [1] defines the completion criteria.
We have already completed 1, 2, 3 and partially 4 in [1].
This commit completes 4 (requirements.txt etc) and 5 (release note).
Python dependency in the installation guide is updated.
Django support plan in Ussuri is updated as well.
References to python 2.7 in the document are updated as well.
[1] https://governance.openstack.org/tc/goals/selected/ussuri/drop-py27.html
Change-Id: I0383920e32e053e1611519be774fab8dec124ccc
It seems hacking 2.0.0 was shipped with incompatible changes
(which is not surprising as this is a new major version).
Let's fix these errors and use a newer hacking.
Change-Id: I8da9dca5d8d74f6dfc2340dabc8d50e6253358e2
Hacking 2.0.0 and its dependencies like flake8 have incompatible changes
and bumping to them leads to pep8 check failure.
It is good to address pep8 warnings in the master branch, but in case of
stable branches it is good to continue to use the same version of hacking.
This commit is proposed to the master branch so that it can be backported.
Change-Id: I2b174ef3231956037650eba19aebe5989dffa617
Previously doc8 is run as part of pep8 tox env. This leads to some tricky
'deps' in pep8 which installs the docs dependencies. This can be fixed by
moving doc8 to the docs related tox envs (docs and releasenotes).
This also helps developers using devstack avoid hitting an error in
"manage.py compilemessages" in stack.sh. The error is caused by sphinx
installed under .tox directory (as compilemessages tries to compile all
message catalogs even under dot directories like .tox).
Developers sometimes change the horizon code under /opt/stack/horizon
and it is not surprising to run "tox -e pep8".
(I think it is more common compared to a chance to run "tox -e docs".)
Thus I believe it is reasonable to move doc8 to the docs env.
Change-Id: I6345ebbcd24afc358555e9be4b2ca700c4b33861
Horizon uses python-memcached while running "tox -e runserver"
so we need to add it to test-requirement.txt as well as
lower-constraints.txt.
Change-Id: I4319cf1a54310171baf1dbaf2e10acae8123dac6
tests.py files are excluded from targets checked by pylint
because it takes longer and longer time to check them somehow.
pylint 2.2.x is supported only in Python 3 and we already switched
our pep8 basepython to python3, so pylint and astroid are installed
only for python3. This seems the easiest way to ensure py27 env works.
literal-comparison error in openstack_dashboard/api/nova.py
is also fixed in this commit as it is simple enough.
Change-Id: Ic8868a44b296dba457be721716ca6f9d37ad9369
Fix the following new errors:
* E305 expected 2 blank lines after class or function definition, found 1
* E126 continuation line over-indented for hanging indent
max_line_length is set to 80 as the default value in pycodestyle is 79
but horizon uses 80 as max_line_length.
Ignore W504 and F405 by configurations.
Reasons of disabling them are explained as comments in tox.ini.
Change-Id: Iee8bcd60c30883fc8c74f08cf20af853cbb5e271
requests is used in non-test code in horizon
(openstack_dashboard/exceptions.py).
It should be declared in requirements.txt.
Closes-Bug: #1789040
Change-Id: I325b5344d45f797d256bb213093082927068a88e
This commit adds two new tox environments for bandit scanner. To run any
of them you can use tox commands:
1) 'tox -e bandit' to run bandit scanner against all the code
2) 'tox -e bandit-baseline' to run bandit scanner only against the last
commit or the current changes.
Bandit job uses 'bandit-baseline' tox environment to veryfy that no new
issues were introduced.
Change-Id: I1fc3bb0d5d151f215b9efc916f921fabaa72e7d8
Nose has been in maintenance mode for the past several years. It has
issue with exit code [1] which leads to false positive results for our
seleniun-headless job.
This patch changes test runner for Horizon tests and does the following
things:
* Django test runner executes test in a different order than Nose does.
That's why we've got an issue with side-effect in
horizon.tests.unit.tables.test_tables.MyToggleAction class. This patch
adds workaround to it.
* Rename filename of test files to names starting with 'test_'
so that the django test runner can find tests expectedly.
* '--with-html-output' option is temporary dropped and will be added in
a following patch.
* Integraion tests is marked via django.test.tag mechanism which is
introduced in Django 1.10
* 'selenium-headless' is broken now because we don't have geckodriver on
gates, this patch makes it non-voting.
* 'tox -e cover' is fixed
* Remove @memorized decorator from
dashboards.project.images.images.tables.filter_tenant_ids function.
[1] https://github.com/nose-devs/nose/issues/984
Depends-On: https://review.openstack.org/572095
Depends-On: https://review.openstack.org/572124
Depends-On: https://review.openstack.org/572390
Depends-On: https://review.openstack.org/572391
Related blueprint: improve-horizon-testing
Change-Id: I7fb2fd7dd40f301ea822154b9809a9a07610c507
Create a tox environment for running the unit tests against the lower
bounds of the dependencies.
Create a lower-constraints.txt to be used to enforce the lower bounds
in those tests.
Add openstack-tox-lower-constraints job to the zuul configuration.
See http://lists.openstack.org/pipermail/openstack-dev/2018-March/128352.html
for more details.
---
horizon specific change:
* Django minimum version is bumped to >=1.11 as horizon rocky
dropped Django 1.8-1.10 support.
* django-babel needs to be bumped to 0.6.2 to support Django 2.0
8762ff5dc0
* nose-exclude needs to be bumped to 0.5.0 to run horizon unit tests
properly. According to my test, 0.4.0 also works but this is
a testing dependency, so we don't need to care multiple versions much.
Otherwise only one test is run for openstack_dashboard unit tests.
https://review.openstack.org/555402 allows us to bump lower requirements.
Co-Authored-By: Akihiro Motoki <amotoki@gmail.com>
Change-Id: I73c3e4531c57d015f6016ca00b056a6fd0d8fc1a
Depends-On: https://review.openstack.org/555034
Depends-On: https://review.openstack.org/555402
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
Signed-off-by: Akihiro Motoki <amotoki@gmail.com>
In order to deal with horizon going into the upper-constraints file so
that horizon plugins can consume it normally, we need to align the
constraints invocation in horizon's tox.ini. This means putting the -C
argument into the dependencies list rather than the pip install line so
that it doesn't get appended to tox installing horizon itself.
While we're in here, move nosehtmloutput into test-requirements so that
we don't need to do .[test] which also doesn't work with constraints.
Needed-By: https://review.openstack.org/550475
Change-Id: I736f79010c2d34e25d41d967a38128c2263ed13f
Moves Django OpenStack Auth content to Horizon, since they are so
tightly coupled. This cleans up the development workflow and should
make keystone / auth related contributions easier.
Implements: blueprint merge-openstack-auth
Change-Id: Ia1cdc47bad1ca6e633073a9f9445b0c7f70d05bc
doc8 is a linter for documents and used in openstack-manuals.
It is better to enforce document linters for simple checking.
The current rules are really simple like:
- line length check (80 chars)
- new line at the end of file
Change-Id: I3810df521068ffc97e25a5fc56b72397bf9783bc
In reviews we usually check import grouping but it is boring.
By using flake8-import-order plugin, we can avoid this.
This flake8 plugin is already used in tempest.
It enforces loose checking so it sounds good to use.
Note that flake8-import-order version is pinned to avoid unexpected
breakage of pep8 job.
Change-Id: I8ccd05eb70350a2441cc2a4d1eafc09ee690b83b
Horizon uses the openstackdocstheme and doesn't need oslosphinx.
Change-Id: I2cb1f0d03d5eab7b5288801877383bbf0aed93a6
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
This patch is the first in a series improving Horizons documentation. It
aims to make the initial quick start section clearer, updates the
information to remove some redundant information, and updates the
appearance to match the rest of the openstack docs.
Change-Id: I942e62b6c2c272dc2b5c91bca42c77677bb4e09d
Implements: blueprint pike-docs-overhaul
hacking version is managed in test-requirements.txt and the latest
version is 0.13.0 now.
However 0.13.0 is in very sorry shape as the Change-Id of hacking
I714caa085fa35cb4aac3b65c73a7de6d4807d04d .
So this patch updates our test-requirements.txt to avoid using
0.13.0.
Change-Id: I2fe6436d2cab2a1acbda9a93d3a9e11a41574c78