1import inspect 2import os 3 4 5def output(capsys): 6 stdout, stderr = capsys.readouterr() 7 8 caller = inspect.stack()[1] 9 caller_dirname = os.path.dirname(caller.filename) 10 output_file = os.path.join( 11 caller_dirname, 12 'output', 13 caller.function + 14 '.out') 15 with open(output_file) as output_file: 16 ref_stdout = output_file.read() 17 18 return stdout, stderr, ref_stdout 19