Introduced changes:
- pre-commit config and rules
- Add pre-commit to pep8 gate, Flake8 is covered in the pre-commit hooks.
- Applying fixes for pre-commit compliance in all code.
Also commit hash will be used instead of version tags in pre-commit to
prevend arbitrary code from running in developer's machines.
pre-commit will be used to:
- trailing whitespace;
- Replaces or checks mixed line ending (mixed-line-ending);
- Forbid files which have a UTF-8 byte-order marker (check-byte-order-marker);
- Checks that non-binary executables have a proper
shebang (check-executables-have-shebangs);
- Check for files that contain merge conflict strings (check-merge-conflict);
- Check for debugger imports and py37+ breakpoint()
calls in python source (debug-statements);
- Attempts to load all yaml files to verify syntax (check-yaml);
- Run flake8 checks (flake8) (local)
For further details about tests please refer to:
https://github.com/pre-commit/pre-commit-hooks
Change-Id: Icd2a9bded756b2bcba1fb7da6abe48503fd9b2d6
Signed-off-by: Moisés Guimarães de Medeiros <moguimar@redhat.com>
Switch to openstackdocstheme 2.2.0 and reno 3.1.0 versions. Using
these versions will allow especially:
* Linking from HTML to PDF document
* Allow parallel building of documents
* Fix some rendering
Update Sphinx version as well.
Create doc/requirements.txt file and use it, remove docs requirements
from lower-constraints, they are not needed
during install or test but only for docs building.
openstackdocstheme renames some variables, so follow the renames
before the next release removes them. A couple of variables are also
not needed anymore, remove them.
Set openstackdocs_auto_name to use 'project' as name.
Depends-On: https://review.opendev.org/728938
Change-Id: Ic3503a8b38e67e50669428b36f6581cb980d687f
This is a mechanically generated change to replace openstack.org
git:// URLs with https:// equivalents.
This is in aid of a planned future move of the git hosting
infrastructure to a self-hosted instance of gitea (https://gitea.io),
which does not support the git wire protocol at this stage.
This update should result in no functional change.
For more information see the thread at
http://lists.openstack.org/pipermail/openstack-discuss/2019-March/003825.html
Change-Id: I46163d46b698a0820c1ae166d4f3d38be11a9e25
In typical unit tests, almost all of the dependencies are mocked or
patched (mock.patch), without any guarantee that the mocked methods
actually exist, or if their signatures are respected (see below). Because
of this, actual issues can easily be overlooked and missed, as the unit
tests are wrongfully passing.
The mock.Mock class accepts a spec as an argument, which only solves half
the problem: it only checks if an attribute exists, based on the given
spec. It does not guarantee that the given attribute is actually a method,
or if its signature is respected. Some unit tests may pass the autospec
argument, but mock doesn't support it at the moment.
mock.patch, mock.patch.object, mock.patch.multiple accept an autospec
argument, but because of a bug, it cannot be used properly.
Adds a fixture which replaces mock.Mock and mock.MagicMock with
subclass which accepts the autospec argument, and on call, it will
check the signature of the called method / function.
Adds a function which replaces mock.mock._patch with a subclass, which
treats the autospec argument properly (consumes the self / cls argument),
and sets autospec=True by default, unless otherwise specified.
WARNING: this function is not a fixture, and in order to benefit from it,
it will have to be called as EARLY as possible, before any test classes
are loaded, otherwise the original mock.mock._patch is used instead.
Needed-By: I3636833962c905faa0f144c7fdc4833037324d31
Needed-By: I4484e63c97bd1cdde3d88855eabe7545784f365e
Closes-Bug: #1735588
Change-Id: I0e4a55fbf4c1d175726ca22b664e240849a99856
As part of the docs migration work[0] for Pike we need to switch to use
the openstackdocstheme.
[0]https://review.openstack.org/#/c/472275/
Change-Id: If8e423b05eac3a8477997833439af74cd3ae7e58
Remove the contents header from the main index page.
Add a subsection for the release notes and move the history node there
so we do not show every release of the project on the main page.
Change-Id: I0776dac515a4eea751686563511128f422e46788
Tell pbr to automatically generate the API documentation and remove the
hand-curated file doing the same. Move the new API documentation section
to a separate toctree to allow us to only show one level of nodes in the
table of contents.
Change-Id: I8edd36090688a607685d5708f99a78fd235defed
Add a fixture for creating real files on the filesystem with contents,
to replace the implementation inside the test base class.
Blueprint oslotest-refactor-test-base-class
Change-Id: Ibca716d1054da973583e5bb4694ef1d64750d50a
Add a fixture for controlling how logging is configured.
Blueprint oslotest-refactor-test-base-class
Change-Id: I5f3f353781a6036f21c4cdb577792bceab242ea4
Add a fixture for controlling whether or not stdout and stderr are
captured as the test runs.
Blueprint oslotest-refactor-test-base-class
Change-Id: Ifa8d991c1a8e3ec643e5350d09fcb3895ac8378e
Add a fixture to replace the code in the test base class that was looking
at OS_TEST_TIMEOUT and setting up a fixtures.Timeout instance.
Blueprint oslotest-refactor-test-base-class
Change-Id: I0432ac28772395be15db539f3797b257eb8933ca
The run_cross_tests.sh script was renamed to oslo_run_cross_tests
in a recent change. Update the documentation to reflect that.
Change-Id: Id16ea9e77e8771758d23c7f39dc3e664df4728e6
The `python-*client`'s usually give back the full package name
i.e. python-keystoneclient, and the script assumes thats where
the tests are, but most clients have their tests under just
*client, or in this case keystoneclient.
Oslo projects have a similar issue.
Change the debug script to accept an optional argument that can
be used to override the guesstimated value.
Change-Id: If0a25ae7ab9f854f87271a377dd228e2ebfb107f
Add another fixture to support mock.patch.multiple() so that test suites
using that function don't have to import mock directly.
Change-Id: I58368dddda347410459d8f5a713e7395253c3697
The bulk of the documentation was coming from README.rst, probably
too much, so I moved it to it's own file under docs.
Change-Id: Iec30feae9c152af7d8b6a1b79670b3f0149d2360
Add docstrings and sphinx structure to expose them through the developer
docs for the library.
Also add a 'docs' target in tox.ini to make building the documentation
locally easier.
Remove the nearly useless usage.rst file.
Turn on the pbr flag to treat doc build warnings as errors.
Closes-bug: #1329952
Change-Id: I274a4144edf4efe9ed786e220e40003fda6f99e0
Fix documentation files so sphinx does not complain about
missing headers or invalid include directives.
Change-Id: Ife520469f62ea048c552b7610b1da5c1bd703d75