Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def instantiate_reporter_for_test():
reporter = TextDiffReporter()
reporter.run_command = lambda command_array: None
return reporter
def setUp(self):
if os.path.exists(self.tmp_dir):
shutil.rmtree(self.tmp_dir)
os.mkdir(self.tmp_dir)
self.diff_tool = 'echo'
self.set_environment_variable(
TextDiffReporter.DIFF_TOOL_ENVIRONMENT_VARIABLE_NAME,
self.diff_tool
)
def __init__(self):
if self.DIFF_TOOL_ENVIRONMENT_VARIABLE_NAME not in os.environ:
raise ReporterMissingException(self.DIFF_TOOL_ENVIRONMENT_VARIABLE_NAME)
diff_tool = os.environ[self.DIFF_TOOL_ENVIRONMENT_VARIABLE_NAME]
super(TextDiffReporter, self).__init__(('Custom', diff_tool))
def test(self):
reporter = TextDiffReporter()
approvals.verify("x", reporter)