
On Fri, Jan 26, 2024 at 03:22:57PM +0100, Peter Krempa wrote:
+# Process the replies file programmatically here. +# The 'conv' argument contains the whole conversation as a list of +# (command, reply) tuples, where both command and reply are already parsed JSON +# and thus represented by native python types (dict, list, etc ...) +# +# The code below contains a few examples and hints how to use the programatic +# processing. Do not forget to use '--regenerate' flag to uptate the output files.
*update
+# +# Beware that this updates the output file which is used as input for any +# subsequent re-run of the tool which can re-apply the modification. +def modify_replies(conv): + return # remove this to enable modifications + version = None # filled with a dictionary with 'major', 'minor', 'micro' keys
Maybe add an empty line after 'return' for readability.
+description = '''A Swiss army knife tool for '.replies' files used by 'qemucapabilitiestest' + +This tool is used to validate, programmatically update or inspect the +'.*replies' normally stored files under 'tests/qemucapabilitiesdata'. + +By default the file(s) passed as positional argument areused. All '.replies'
*are used
+iles in a directory can be processed by specifying '--repliesdir /path/to/dir'
*files
+argument. + +The default mode is validation which checks the following: + - each command has a reply and both are valid JSON + - numbering of the 'id' field is as expected + - the input file has the expected JSON formatting + +The tool can be also used to programmaticaly modify the '.replies' file by +editting the 'modify_replies' method directly in the source, or for
*editing With the typos fixed, Reviewed-by: Andrea Bolognani <abologna@redhat.com> -- Andrea Bolognani / Red Hat / Virtualization