kitty.data.report module¶
This module defines the Report
class
-
class
kitty.data.report.
Report
(name, default_failed=False)[source]¶ Bases:
object
This class represent a report for a single test. This report may contain subreports from nested entities.
Example: In this example, the report, generated by the controller, indicates failure.
report = Report('Controller') report.add('generation time', 0) report.failed('target does not respond')
-
ERROR
= 'error'¶
-
FAILED
= 'failed'¶
-
PASSED
= 'passed'¶
-
__init__
(name, default_failed=False)[source]¶ Parameters: - name – name of the report (or the issuer)
- default_failed – is the default status of the report failed (default: False)
-
add
(key, value)[source]¶ Add an entry to the report
Parameters: - key – entry’s key
- value – the actual value
Example: my_report.add('retry count', 3)
-
allowed_statuses
= ['passed', 'failed', 'error']¶
-
clear
()[source]¶ Set the report to its defaults. This will clear the report, keeping only the name and setting the failure status to the default.
-
error
(reason=None)[source]¶ Set the test status to Report.ERROR, and set the error reason
Parameters: reason – error reason (default: None)
-
failed
(reason=None)[source]¶ Set the test status to Report.FAILED, and set the failure reason
Parameters: reason – failure reason (default: None)
-
classmethod
from_dict
(d, encoding='base64')[source]¶ Construct a
Report
object from dictionary.Parameters: - d (dictionary) – dictionary representing the report
- encoding – encoding of strings in the dictionary (default: ‘base64’)
Returns: Report object
-
get
(key)[source]¶ Get a value for a given key
Parameters: key – entry’s key Returns: corresponding value
-
get_status
()[source]¶ Get the status of the report and its sub-reports.
Return type: str Returns: report status (‘passed’, ‘failed’ or ‘error’)
-
is_failed
()[source]¶ Deprecated since version 0.6.7: use
get_status()
-
reserved_keys
= {'status': 'set_status(status), success(), failed(reason) or error(reason)', 'failed': 'failed(reason)'}¶
-