avocado-framework/avocado — pull request #244 by ruda (2014-10-28 17:01:50+00:00)
Title: Introduce avocado.utils.script module [V2]

Follow up of PR #242.

Introduce `avocado.utils.script` module to handle the creation of scripts stored in the file system.

The module includes a flexible class for creating generic scripts and includes utilities functions too. Some examples:

CONTENT = """
#!/bin/sh
echo "Hi There!"
"""

x = avocado.utils.script.Script('/var/tmp/test.sh', CONTENT)
x.save()
... do something with x, like run it ...
x.remove()

t = avocado.utils.script.make_temp_script('test.sh', CONTENT)
... do something with y, like run it ...

Many Avocado's functional tests makes use of script creation, so we will handle these creation using this proper module.

Changes from V2 to original PR.
* Split class `Script` to `Script` and `TemporaryScript`. The original Script class was dealing with permanent and temporary scripts by doing some trick, so I realize that is better to split into proper classes.