Skip to content

Commit

Permalink
Merge pull request #607 from lmr/doc-fixes
Browse files Browse the repository at this point in the history
Doc fixes
  • Loading branch information
lmr committed May 21, 2015
2 parents 40fef32 + 2f2b003 commit e02cbaf
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 21 deletions.
2 changes: 1 addition & 1 deletion docs/source/MultiplexConfig.rst
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ The environment created for the nodes ``fedora`` and ``osx`` are:
Variants
========

In the end all leafs are gathered and turned into parameters, more specifically into
In the end all leaves are gathered and turned into parameters, more specifically into
``AvocadoParams``::

setup:
Expand Down
40 changes: 20 additions & 20 deletions docs/source/WritingTests.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,32 +38,31 @@ Let's re-create an old time favorite, ``sleeptest``, which is a functional
test for avocado (old because we also use such a test for autotest). It does
nothing but ``time.sleep([number-seconds])``::

#!/usr/bin/python
#!/usr/bin/python

import time
import time

from avocado import test
from avocado import main
from avocado import test
from avocado import main


class SleepTest(test.Test):
class SleepTest(test.Test):

"""
Example test for avocado.
"""
default_params = {'sleep_length': 1.0}

def runTest(self):
"""
Sleep for length seconds.
Example test for avocado.
"""
self.log.debug("Sleeping for %.2f seconds", self.params.sleep_length)
time.sleep(self.params.sleep_length)

def runTest(self):
"""
Sleep for length seconds.
"""
sleep_length = self.params.get('sleep_length', default=1)
self.log.debug("Sleeping for %.2f seconds", sleep_length)
time.sleep(sleep_length)

if __name__ == "__main__":
main()

if __name__ == "__main__":
main()

This is about the simplest test you can write for avocado (at least, one using
the avocado APIs). An avocado test is basically a class that inherits from
Expand All @@ -89,16 +88,17 @@ automatically saved to test results (as long as the output format supports it).
If you choose to save binary data to the whiteboard, it's your responsibility to
encoded it first (base64 is the obvious choice).

Building on the previously demonstrated sleeptest, suppose that you want to save the
Building on the previously demonstrated ``sleeptest``, suppose that you want to save the
sleep length to be used by some other script or data analysis tool::

def runTest(self):
"""
Sleep for length seconds.
"""
self.log.debug("Sleeping for %.2f seconds", self.params.sleep_length)
time.sleep(self.params.sleep_length)
self.whiteboard = "%.2f" % self.params.sleep_length
sleep_length = self.params.get('sleep_length', default=1)
self.log.debug("Sleeping for %.2f seconds", sleep_length)
time.sleep(sleep_length)
self.whiteboard = "%.2f" % sleep_length

The whiteboard can and should be exposed by files generated by the available test result
plugins. The ``results.json`` file already includes the whiteboard for each test.
Expand Down

0 comments on commit e02cbaf

Please sign in to comment.