mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-26 20:31:27 -07:00
Add rstcheck to ansible-test and correct issues. (#23550)
* Add rstcheck to ansible-test. * Fix rst code-block languages and syntax errors. * Fix rst inline literals. * Update python 2 code block to pass tests on py 3.
This commit is contained in:
parent
811eb66703
commit
cb1f57d4e5
9 changed files with 86 additions and 10 deletions
|
@ -171,7 +171,7 @@ You should never do this in a module:
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
print "some status message"
|
||||
print("some status message")
|
||||
|
||||
Because the output is supposed to be valid JSON.
|
||||
|
||||
|
|
|
@ -130,6 +130,7 @@ to yield text but instead do the conversion explicitly ourselves. For example:
|
|||
# Handle the exception gracefully -- usually by displaying a good
|
||||
# user-centric error message that can be traced back to this piece
|
||||
# of code.
|
||||
pass
|
||||
|
||||
.. note:: Much of Ansible assumes that all encoded text is UTF-8. At some
|
||||
point, if there is demand for other encodings we may change that, but for
|
||||
|
@ -293,7 +294,8 @@ new exception-catching syntax which uses the ``as`` keyword:
|
|||
|
||||
Do **not** use the following syntax as it will fail on every version of Python-3:
|
||||
|
||||
.. code-block:: python
|
||||
.. This code block won't highlight because python2 isn't recognized. This is necessary to pass tests under python 3.
|
||||
.. code-block:: python2
|
||||
|
||||
try:
|
||||
a = 2/0
|
||||
|
@ -399,7 +401,6 @@ Python-2 and Python-3. You may still see this used in some modules:
|
|||
.. code-block:: python
|
||||
|
||||
from ansible.module_utils.pycompat24 import get_exception
|
||||
[...]
|
||||
|
||||
try:
|
||||
a = 2/0
|
||||
|
|
|
@ -185,11 +185,11 @@ If the PR does not resolve the issue, or if you see any failures from the unit/i
|
|||
|
|
||||
| When I ran this Ubuntu 16.04 it failed with the following:
|
||||
|
|
||||
| ```
|
||||
| \```
|
||||
| BLARG
|
||||
| StrackTrace
|
||||
| RRRARRGGG
|
||||
| ```
|
||||
| \```
|
||||
|
||||
When you are done testing a feature branch, you can remove it with the following command:
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue