mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-05-07 22:20:24 +00:00
Capturing results for other command output.
This commit is contained in:
+9
-1
@@ -200,7 +200,15 @@ class BaseTest(object):
|
|||||||
raise
|
raise
|
||||||
|
|
||||||
def check_cmd_output(self, command, gold_name, match_prepare=None, expected_code=0):
|
def check_cmd_output(self, command, gold_name, match_prepare=None, expected_code=0):
|
||||||
self.verify_match(self.get_gold(gold_name), self.run_cmd(command, expected_code=expected_code), match_prepare)
|
try:
|
||||||
|
output = self.run_cmd(command, expected_code=expected_code)
|
||||||
|
self.verify_match(self.get_gold(gold_name), output, match_prepare)
|
||||||
|
except:
|
||||||
|
if self.captureResults:
|
||||||
|
with open(self.get_gold_filename(gold_name), "w") as f:
|
||||||
|
f.write(output)
|
||||||
|
else:
|
||||||
|
raise
|
||||||
|
|
||||||
def read_file(self, path):
|
def read_file(self, path):
|
||||||
with open(os.path.join(os.environ["HOME"], ".aptly", path), "r") as f:
|
with open(os.path.join(os.environ["HOME"], ".aptly", path), "r") as f:
|
||||||
|
|||||||
Reference in New Issue
Block a user