tl.testing.script
Installing callable scripts.
Functions
-
tl.testing.script.install(text, path=None, name=None, on_path=False, env=None)[source]
Install a mock Python script that can be called as an external program.
- text
- content of the script without the interpreter (#!...) line
- path
- optional target path (including the script’s file name)
- name
- optional script’s file name, put it in a temporary directory
- on_path
- whether to make the script available on the binary search path (PATH)
- env
- optional environment variable to store the script path (e.g. PAGER)
The path to the script is appended to a list of script to remove upon
tear-down. If environment variables are modified, their original state is
saved so it may be reset after the test has run.
Returns the path to the script.
-
tl.testing.script.teardown_scripts(test=None)[source]
Scripts-related test tear-down handler.
Scripts created by the test are removed on tear-down. The environment is
reset to its state before the test run.