2
This is the check.py module.
4
The check module provides different ways to check if the test failed or passed
10
from ldtputils import imagecompare
17
Superclass for the rest of the test checks
22
class FileComparison(Check):
24
Test check for file comparison. If two files are equal, the test passes.
26
def __init__(self, oracle, test):
28
Main constructor. It requires two existing files paths.
31
@param oracle: The path to the oracle file to compare the test file against.
34
@param test: The path to the test file to compare the test file against.
42
def perform_test(self):
44
Perform the test check.
46
It the two files are equal, the test passes. Otherwise, it fails.
48
if filecmp.cmp(self.oracle, self.test):
53
class ScreenshotCompare(FileComparison):
54
def perform_test(self, max_diff=0.0):
55
res = imagecompare(self.oracle, self.test)
62
shutil.copy(self.test, self.oracle)