manual: fix typos
This commit is contained in:
parent
7ba7c10881
commit
feddd5e7f8
2 changed files with 22 additions and 27 deletions
|
@ -347,7 +347,7 @@ import ./make-test-python.nix {
|
||||||
|
|
||||||
## Failing tests early {#ssec-failing-tests-early}
|
## Failing tests early {#ssec-failing-tests-early}
|
||||||
|
|
||||||
To fail tests early when certain invariables are no longer met (instead of waiting for the build to time out), the decorator `polling_condition` is provided. For example, if we are testing a program `foo` that should not quit after being started, we might write the following:
|
To fail tests early when certain invariants are no longer met (instead of waiting for the build to time out), the decorator `polling_condition` is provided. For example, if we are testing a program `foo` that should not quit after being started, we might write the following:
|
||||||
|
|
||||||
```py
|
```py
|
||||||
@polling_condition
|
@polling_condition
|
||||||
|
@ -369,29 +369,29 @@ with foo_running:
|
||||||
:
|
:
|
||||||
specifies how often the condition should be polled:
|
specifies how often the condition should be polled:
|
||||||
|
|
||||||
```py
|
```py
|
||||||
@polling_condition(seconds_interval=10)
|
@polling_condition(seconds_interval=10)
|
||||||
def foo_running():
|
def foo_running():
|
||||||
machine.succeed("pgrep -x foo")
|
machine.succeed("pgrep -x foo")
|
||||||
```
|
```
|
||||||
|
|
||||||
`description`
|
`description`
|
||||||
|
|
||||||
:
|
:
|
||||||
is used in the log when the condition is checked. If this is not provided, the description is pulled from the docstring of the function. These two are therefore equivalent:
|
is used in the log when the condition is checked. If this is not provided, the description is pulled from the docstring of the function. These two are therefore equivalent:
|
||||||
|
|
||||||
```py
|
```py
|
||||||
@polling_condition
|
@polling_condition
|
||||||
def foo_running():
|
def foo_running():
|
||||||
"check that foo is running"
|
"check that foo is running"
|
||||||
machine.succeed("pgrep -x foo")
|
machine.succeed("pgrep -x foo")
|
||||||
```
|
```
|
||||||
|
|
||||||
```py
|
```py
|
||||||
@polling_condition(description="check that foo is running")
|
@polling_condition(description="check that foo is running")
|
||||||
def foo_running():
|
def foo_running():
|
||||||
machine.succeed("pgrep -x foo")
|
machine.succeed("pgrep -x foo")
|
||||||
```
|
```
|
||||||
|
|
||||||
## Adding Python packages to the test script {#ssec-python-packages-in-test-script}
|
## Adding Python packages to the test script {#ssec-python-packages-in-test-script}
|
||||||
|
|
||||||
|
|
|
@ -607,7 +607,7 @@ import ./make-test-python.nix {
|
||||||
<section xml:id="ssec-failing-tests-early">
|
<section xml:id="ssec-failing-tests-early">
|
||||||
<title>Failing tests early</title>
|
<title>Failing tests early</title>
|
||||||
<para>
|
<para>
|
||||||
To fail tests early when certain invariables are no longer met
|
To fail tests early when certain invariants are no longer met
|
||||||
(instead of waiting for the build to time out), the decorator
|
(instead of waiting for the build to time out), the decorator
|
||||||
<literal>polling_condition</literal> is provided. For example, if
|
<literal>polling_condition</literal> is provided. For example, if
|
||||||
we are testing a program <literal>foo</literal> that should not
|
we are testing a program <literal>foo</literal> that should not
|
||||||
|
@ -635,12 +635,10 @@ with foo_running:
|
||||||
<para>
|
<para>
|
||||||
: specifies how often the condition should be polled:
|
: specifies how often the condition should be polled:
|
||||||
</para>
|
</para>
|
||||||
<programlisting>
|
<programlisting language="python">
|
||||||
```py
|
|
||||||
@polling_condition(seconds_interval=10)
|
@polling_condition(seconds_interval=10)
|
||||||
def foo_running():
|
def foo_running():
|
||||||
machine.succeed("pgrep -x foo")
|
machine.succeed("pgrep -x foo")
|
||||||
```
|
|
||||||
</programlisting>
|
</programlisting>
|
||||||
<para>
|
<para>
|
||||||
<literal>description</literal>
|
<literal>description</literal>
|
||||||
|
@ -650,19 +648,16 @@ def foo_running():
|
||||||
provided, the description is pulled from the docstring of the
|
provided, the description is pulled from the docstring of the
|
||||||
function. These two are therefore equivalent:
|
function. These two are therefore equivalent:
|
||||||
</para>
|
</para>
|
||||||
<programlisting>
|
<programlisting language="python">
|
||||||
```py
|
|
||||||
@polling_condition
|
@polling_condition
|
||||||
def foo_running():
|
def foo_running():
|
||||||
"check that foo is running"
|
"check that foo is running"
|
||||||
machine.succeed("pgrep -x foo")
|
machine.succeed("pgrep -x foo")
|
||||||
```
|
</programlisting>
|
||||||
|
<programlisting language="python">
|
||||||
```py
|
|
||||||
@polling_condition(description="check that foo is running")
|
@polling_condition(description="check that foo is running")
|
||||||
def foo_running():
|
def foo_running():
|
||||||
machine.succeed("pgrep -x foo")
|
machine.succeed("pgrep -x foo")
|
||||||
```
|
|
||||||
</programlisting>
|
</programlisting>
|
||||||
</section>
|
</section>
|
||||||
<section xml:id="ssec-python-packages-in-test-script">
|
<section xml:id="ssec-python-packages-in-test-script">
|
||||||
|
|
Loading…
Reference in a new issue