Commit Graph

43 Commits

Author SHA1 Message Date
songwenping 49948dfad1 Remove unnecessary unicode prefixes
Change-Id: I554dee8e91468f8ea2dbcb99a925a2e9057ac378
2022-04-19 20:01:18 +08:00
Hervé Beraud 2f4cb354f7 Adding pre-commit
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>
2020-09-15 17:10:31 +02:00
Zuul a789adbd22 Merge "Add release notes links to doc index" 2020-05-26 12:30:28 +00:00
Andreas Jaeger 58b40e7f2a Switch to newer openstackdocstheme and reno versions
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
2020-05-18 20:59:21 +02:00
Hervé Beraud 92fce72557 Add release notes links to doc index
Change-Id: If1faca1d9914177c555c86b882047be32718d114
2020-04-16 17:42:01 +02:00
Andreas Jaeger 4d45f96942 [ussuri][goal] Drop python 2.7 support and testing
OpenStack is dropping the py2.7 support in ussuri cycle.

Complete discussion & schedule can be found in
- http://lists.openstack.org/pipermail/openstack-discuss/2019-October/010142.html
- https://etherpad.openstack.org/p/drop-python2-support

Ussuri Communtiy-wide goal:
https://governance.openstack.org/tc/goals/selected/ussuri/drop-py27.html

Update docs building to use modern sphinx-build.
Update to use apidoc for newer sphinx.
Remove cruft from setup.cfg and doc/source.conf.py

Change-Id: I6a0643fcf8e28e09b1c69cda98dc53c71e6c508d
2020-02-03 20:37:28 +01:00
Stephen Finucane 0b3c98a349 trivial: Cleanup of doc config file
Change-Id: Ie5f147cff6e92ce64c32b50a01e65c042dbc0b74
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2019-12-19 09:44:01 +00:00
jacky06 c36485c7ce Replace git.openstack.org URLs with opendev.org URLs
Change-Id: Ife085fd9a36d96b00c43ced290c1d761a782d03f
2019-06-10 14:36:33 +00:00
Ian Wienand 72a20f77ee Replace openstack.org git:// URLs with https://
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
2019-03-24 20:35:32 +00:00
melissaml 93d87e25ec Trivial: Update pypi url to new url
Pypi url changed from [1] to [2]

[1] https://pypi.python.org/pypi/<package>
[2] https://pypi.org/project/<package>

Change-Id: I5e106592e0df1d8cdb058e578cc423123f6a5b47
2018-04-21 12:12:20 +08:00
Claudiu Belu 0bde35899a Adds mock autospec fixture
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
2018-01-06 12:21:14 -08:00
ChangBo Guo(gcb) 61d067b037 rearrange content to fit the new standard layout
Depends-On: Ia750cb049c0f53a234ea70ce1f2bbbb7a2aa9454
Change-Id: Ic1cf3f4b0510d18961d3d15d7776aeeebb071193
2017-07-17 09:39:30 +00:00
Jenkins 46f407733b Merge "Trivial fix style in document" 2017-07-04 10:46:23 +00:00
Van Hung Pham 9c7d4f8f03 Switch from oslosphinx to openstackdocstheme
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
2017-06-30 10:49:51 +07:00
Van Hung Pham a1fe6d2389 Trivial fix style in document
Make the underline match the title

Change-Id: I01a0ce6d6016100ecde11022b915ce1bc0ac0ecd
2017-06-22 17:40:13 +07:00
venkatamahesh 14a292b803 Fix misspelling
Change-Id: I763308d2d763c85fcdb9021114385477ad4b5a1d
2016-02-04 02:14:14 +00:00
Doug Hellmann 1c034de9aa Add documentation about using oslo_debug_helper
Change-Id: I7fcae0676aaa2c598dbd14c0c7674d95357c4022
2015-09-25 14:08:24 +00:00
Doug Hellmann 748eca9363 clean up readme and doc title
Make the readme and documentation title consistent and descriptive.

Change-Id: I1e1e375272b28ad470d52d91b14e1c8d13e6829d
2015-09-25 14:08:24 +00:00
Doug Hellmann 8040a57c47 clean up toctree
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
2015-09-25 14:08:22 +00:00
Doug Hellmann e265141db8 auto-generate API documentation
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
2015-09-25 14:07:46 +00:00
Doug Hellmann cc8622fbbd Add documentation for cross-project unit testing
Change-Id: I4270af00b14d33a66439fa8d7141c192df1f0c3a
2015-07-02 12:22:08 +00:00
Doug Hellmann cc57067355 Add CreateFileWithContent fixture
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
2015-06-12 19:15:18 +00:00
Doug Hellmann 5f63439ee7 Create ConfigureLogging fixture
Add a fixture for controlling how logging is configured.

Blueprint oslotest-refactor-test-base-class

Change-Id: I5f3f353781a6036f21c4cdb577792bceab242ea4
2015-06-12 19:14:45 +00:00
Doug Hellmann 9e7c3e99eb Create CaptureOutput fixture
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
2015-06-12 14:35:28 +00:00
Doug Hellmann a7cd68519b Create Timeout wrapper fixture
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
2015-06-12 14:34:51 +00:00
Ben Nemec b31057ebec Update docs for new script name
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
2015-01-30 19:27:08 +00:00
Steve Martinelli fa1f1302e3 Clean up the docs for oslo_debug_helper
Just a minor clean up to provide a bit more information and
clarity on how to run the debugger.

Change-Id: I3f128780e8420e4074f3ec4553019e1afb429eca
2014-10-22 01:19:49 -04:00
Steve Martinelli e5c14b74d3 Add an extra parameter for test directory in debugger script
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
2014-09-29 21:50:41 -04:00
Jenkins c8bbab8ee6 Merge "Add history/changelog to docs" 2014-09-29 15:39:41 +00:00
Doug Hellmann b3610f0c7e Add links to best practices video and etherpad
Sean, Jay, and Dan presented some tips for using mock safely.

Change-Id: I92b27617eddb1a3beb79cf168939828f0f79c8a5
2014-09-19 16:10:54 -04:00
Davanum Srinivas d77d23e92d Add history/changelog to docs
Change-Id: I9d54f6538beff5d1c013c73f11a4aa6c32933c66
2014-09-10 08:32:31 -04:00
Davanum Srinivas aa9c845c82 fix typo and formatting in contributing docs
Change-Id: I80405a19a52e9b31988fe6317344da3f9d002f2e
2014-09-10 08:13:54 -04:00
Jenkins bbfde1e29c Merge "Add fixture for mock.patch.multiple" 2014-09-05 16:32:16 +00:00
Jenkins 6e1b5eefe0 Merge "Cleaning up index.rst file" 2014-09-05 14:46:12 +00:00
Doug Hellmann 4be5bc3b89 Add fixture for mock.patch.multiple
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
2014-09-05 08:49:10 -04:00
Steve Martinelli 48955949b3 Add documentation for running oslo_debug_heler.sh
Removed inline comments from the shell file and added them to
the developer docs.

Change-Id: Iac0f969165883e173389a42e1bd1b0bc5d513553
2014-08-25 17:18:11 -04:00
Steve Martinelli 04689e482e Restructure oslotest docs
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
2014-08-25 16:47:14 -04:00
Christian Berendt 92e4691bb0 Cleaning up index.rst file
Removed notes about the generation of the file.

Change-Id: I69e717a0edb08cd369f28c8b899889811b17657d
2014-07-17 16:35:11 +02:00
Doug Hellmann aec9e529fd Add API documentation
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
2014-06-23 08:18:21 -07:00
Doug Hellmann ea4d4da825 Update project name in doc build
The project name should be oslotest not oslo.test.

Change-Id: I1ff96b8ab7c12a5718c39e9afa998d463cd4b00d
2014-04-10 11:18:01 -07:00
Doug Hellmann faf855314a Fix up documentation files
Fix documentation files so sphinx does not complain about
missing headers or invalid include directives.

Change-Id: Ife520469f62ea048c552b7610b1da5c1bd703d75
2014-03-11 15:53:31 -04:00
Doug Hellmann 224b61f78c Switch to oslosphinx
Change-Id: If89d9324b7de199c628726a83919276f5483d337
2014-02-18 05:28:57 -08:00
Doug Hellmann 40b1d4c690 apply oslo-cookiecutter
Change-Id: I5da6b3ae5769255c27c9e549940a3214f8c53bb4
2014-01-31 15:42:43 -08:00