tl.testing.fs
Sandboxes of directories and files.
Functions
-
tl.testing.fs.ls()[source]
Print text lines listing the current working directory recursively.
The format of the text lines is the same as read by the new_sandbox()
function. Lines are printed in alphabetical order.
-
tl.testing.fs.new_sandbox(specification)[source]
Create a directory with items given as lines of text, and chdir to it.
The specification is a multi-line string each of whose lines takes one of
the following forms:
- d foo
- create a directory named foo
- f foo/bar asdf
- create a file named bar inside foo/ with content ‘asdf’
- l baz -> foo/bar
- create a symbolic link named baz, pointing to foo/bar
The sandbox directory will be added to the known sandboxes so it can be
removed when the test setup is torn down.
-
tl.testing.fs.setup_sandboxes(test=None)[source]
Sandbox-related test set-up handler.
As creating a sandbox changes the current working directory to it, the
original working directory is saved by the test setup so it may be
restored upon tear-down.
-
tl.testing.fs.teardown_sandboxes(test=None)[source]
Sandbox-related test tear-down handler.
Sandboxes created by the test are removed and the working directory is
changed back to the current one before the test.