1dd12d8deb
During reviewing https://review.opendev.org/c/openstack/horizon/+/772603, we noticed that a method decorated by create_mocks is called multiple time in a single test. Previously create_mocks decorator does not stop mocking, so this means that multiple active mock can exist for one method. In general, it is not a good idea to mock a method multiple times at the same time. To cope with this situation, this commit ensures for create_mocks decorator to stop active mocks when exiting the decorator. This works for most cases, but it does not work only when mocking and assertions are handled by separate methods and test logic is placed between them. To cope with this, "stop_mock" optional argument is introduced. FYI: Details on why "stop_mock" is needed. I explored various ways but could not find a good way so far. create_mocks needs to be a decorator as it needs to refer an object reference (self). On the other hand, if we would like to merge the logic of mocking and assertions (for example, _stub_api_calls() and _check_api_calls() in openstack_dashboard/dashboards/project/overview/tests.py), a context manager would be good as we would like to call it inside a class. However, we cannot mix a decorator and a context manger as a decorator is executed when a context manager is iniitialized and stopping mock in the create_mocks decorator is done during the initialization of the context manager and methods are not mocked when test code is run. Change-Id: I9e37dc1eaa08adf36d11975fed6f5a0a90cdde52 |
||
---|---|---|
.zuul.d | ||
doc | ||
horizon | ||
openstack_auth | ||
openstack_dashboard | ||
playbooks | ||
releasenotes | ||
roles | ||
tools | ||
.eslintignore | ||
.eslintrc | ||
.gitignore | ||
.gitreview | ||
.mailmap | ||
.pylintrc | ||
CONTRIBUTING.rst | ||
HACKING.rst | ||
LICENSE | ||
MANIFEST.in | ||
README.rst | ||
babel-django.cfg | ||
babel-djangojs.cfg | ||
bindep.txt | ||
lower-constraints.txt | ||
manage.py | ||
package.json | ||
plugin-registry.csv | ||
reno.yaml | ||
requirements.txt | ||
setup.cfg | ||
setup.py | ||
test-requirements.txt | ||
test-shim.js | ||
tox.ini |
README.rst
Horizon (OpenStack Dashboard)
Horizon is a Django-based project aimed at providing a complete
OpenStack Dashboard along with an extensible framework for building new
dashboards from reusable components. The
openstack_dashboard
module is a reference implementation of
a Django site that uses the horizon
app to provide
web-based interactions with the various OpenStack projects.
- Project documentation: https://docs.openstack.org/horizon/latest/
- Release management: https://launchpad.net/horizon
- Blueprints and feature specifications: https://blueprints.launchpad.net/horizon
- Issue tracking: https://bugs.launchpad.net/horizon
- Release notes: https://docs.openstack.org/releasenotes/horizon/
Using Horizon
See doc/source/install/index.rst
about how to install
Horizon in your OpenStack setup. It describes the example steps and has
pointers for more detailed settings and configurations.
It is also available at Installation Guide.
Getting Started for Developers
doc/source/quickstart.rst
or Quickstart
Guide describes how to setup Horizon development environment and
start development.
Building Contributor Documentation
This documentation is written by contributors, for contributors.
The source is maintained in the doc/source
directory
using reStructuredText and
built by Sphinx
To build the docs, use:
$ tox -e docs
Results are in the doc/build/html
directory