filediff(file1,
file2,
ignore=[ ] ,
sort=True,
replacementList=[ ] ,
include=[ ] ,
unifiedDiffOutput=None)
| source code
|
Perform a file comparison between two (preprocessed) input files,
returning true if the files are equivalent.
The method reads in the files and loads the contents of each as a list
of strings. The two files are said to be equal if the two lists are
equal. The method allows for preprocessing of the string lists to trim
down their contents prior to the comparison being performed.
Preprocessing is either to remove entries from the lists which match any
entry in a set of regular expressions, include only lines which match any
entry in a set of regular expressions, replace certain keywords in the
string values of each list with a set value (e.g. to replace time stamps
etc), or to sort the lists before the comparison (e.g. where determinism
may not exist). Verbose logging of the method occurs at DEBUG level
showing the contents of the processed lists prior to the comparison being
performed.
- Parameters:
file1 - The full path to the first file to use in the comparison
file2 - The full path to the second file to use in the comparison,
typically a reference file
ignore - A list of regular expressions which remove entries in the input
file contents before making the comparison
sort - Boolean to sort the input file contents before making the
comparison
replacementList - A list of tuples (key, value) where matches to key are replaced
with value in the input file contents before making the
comparison
include - A list of regular expressions used to select lines from the input
file contents to use in the comparison
unifiedDiffOutput - If specified, indicates the full path of a file to which unified
diff output will be written, if the diff fails.
- Returns: boolean
- success (True / False)
- Raises:
|