reviewboard.testing.scmtool¶
-
class
TestTool
(repository)[source]¶ Bases:
reviewboard.scmtools.git.GitTool
-
get_file
(path, revision, **kwargs)[source]¶ Return a file from the repository.
This testing tool allows for special paths that allow callers to optionally define the data to return and the encoding to use for that data.
If the path starts with
/data:
, then what comes after will be returned as data (with a newline appended to the data). Otherwise, a standardHello, world!\n
will be returned.If the path ends with
;encoding=...
, then whatever is returned will be encoded in the specified encoding type.If the path starts with
bad:file-not-found
, then this will simulate areviewboard.scmtools.errors.FileNotFoundError
.If the path starts with
bad:scm-error
, then this will simulate areviewboard.scmtools.errors.SCMError
.Changed in version 4.0.7: Added support for special
bad:file-not-found
andbad:scm-error
paths.Parameters: - path (unicode) – The path to retrieve, optionally with custom data and an encoding.
- revision (unicode, unused) – The revision to retrieve. This is ignored.
- **kwargs (dict, unused) – Additional keyword arguments for the request.
Returns: The resulting file contents.
Return type: Raises: reviewboard.scmtools.errors.FileNotFoundError
– The path started withbad:file-not-found
.reviewboard.scmtools.errors.SCMError
– The path started withbad:scm-error
.
-
-
class
TestToolDiffX
(repository)[source]¶ Bases:
reviewboard.testing.scmtool.TestTool
SCMTool that uses DiffX diffs.
New in version 4.0.6.