Merge pull request #17 from robertbaldyga/fs_utils-timeout
Introduce option to define timeout for time-consuming file operations
This commit is contained in:
@@ -14,18 +14,14 @@ class File(FsItem):
|
||||
def __init__(self, full_path):
|
||||
FsItem.__init__(self, full_path)
|
||||
|
||||
def compare(self, other_file):
|
||||
return fs_utils.compare(str(self), str(other_file))
|
||||
def compare(self, other_file, timeout: timedelta = timedelta(minutes=30)):
|
||||
return fs_utils.compare(str(self), str(other_file), timeout)
|
||||
|
||||
def diff(self, other_file):
|
||||
return fs_utils.diff(str(self), str(other_file))
|
||||
def diff(self, other_file, timeout: timedelta = timedelta(minutes=30)):
|
||||
return fs_utils.diff(str(self), str(other_file), timeout)
|
||||
|
||||
def md5sum(self, binary=True):
|
||||
output = TestRun.executor.run(
|
||||
f"md5sum {'-b' if binary else ''} {self.full_path}")
|
||||
if output.exit_code != 0:
|
||||
raise Exception(f"Md5sum command execution failed! {output.stdout}\n{output.stderr}")
|
||||
return output.stdout.split()[0]
|
||||
def md5sum(self, binary=True, timeout: timedelta = timedelta(minutes=30)):
|
||||
return fs_utils.md5sum(str(self), binary, timeout)
|
||||
|
||||
def read(self):
|
||||
return fs_utils.read_file(str(self))
|
||||
|
Reference in New Issue
Block a user