class scripttest.TestFileEnvironment(base_path=None, template_path=None, environ=None, cwd=None, start_clear=True, ignore_paths=None, ignore_hidden=True, capture_temp=False, assert_no_temp=False, split_cmd=True)
This represents an environment in which files will be written, and
scripts will be run.
Objects that are returned
These objects are returned when you use env.run(...). The
ProcResult object is returned, and it has .files_updated,
.files_created, and .files_deleted which are dictionaries of
FoundFile and FoundDir. The files in .files_deleted represent
the pre-deletion state of the file; the other files represent the
state of the files after the command is run.
and .files_deleted. These objects dictionary
class scripttest.ProcResult(test_env, args, stdin, stdout, stderr, returncode, files_before, files_after)
Represents the results of running a command in
Attributes to pay particular attention to:
- stdout, stderr:
- What is produced on those streams.
- The return code of the script.
- files_created, files_deleted, files_updated:
- Dictionaries mapping filenames (relative to the base_path)
to FoundFile or
class scripttest.FoundFile(base_path, path)
Represents a single file found as the result of a command.
- The path of the file, relative to the base_path
- The full path
- The contents of the file.
- The results of os.stat. Also mtime and size
contain the .st_mtime and .st_size of the stat.
- The modification time of the file.
- The size (in bytes) of the file.
You may use the in operator with these objects (tested against
the contents of the file), and the .mustcontain() method.
class scripttest.FoundDir(base_path, path)
Represents a directory created by a command.