I am running integration tests with Nose. In one of my tests, I need to get the output and parse it to find a specific string.
def test_diagnostic_tool():
with Capturing() as output:
failures = run_integration_testing_exe('*', test_exe='DiagnosticTool.exe', use_default_composed_filter=False)
eq_(failures, 0)
class Capturing(list):
def __enter__(self):
self._stdout = sys.stdout
sys.stdout = self._stringio = StringIO()
return self
def __exit__(self, *args):
self.extend(self._stringio.getvalue().splitlines())
sys.stdout = self._stdout
This does not work. The 'output' variable contains only a small string from a print somewhere in the call structure.
The 'run_integration_testing_exe' function is calling another function and the external exe program is called there. In the shell, everthing outputs fine, so I was wondering if there was a way to capture all of that and parse it.