Replace std::cout with py::print in tests

With this change both C++ and Python write to sys.stdout which resolves
the capture issues noted in #351. Therefore, the related workarounds are
removed.
This commit is contained in:
Dean Moldovan
2016-09-07 00:50:10 +02:00
parent c84b37b577
commit 81511be341
11 changed files with 51 additions and 64 deletions

View File

@@ -70,20 +70,12 @@ class Capture(object):
self.out = ""
self.err = ""
def _flush(self):
"""Workaround for issues on Windows: to be removed after tests get py::print"""
sys.stdout.flush()
os.fsync(sys.stdout.fileno())
sys.stderr.flush()
os.fsync(sys.stderr.fileno())
return self.capfd.readouterr()
def __enter__(self):
self._flush()
self.capfd.readouterr()
return self
def __exit__(self, *_):
self.out, self.err = self._flush()
self.out, self.err = self.capfd.readouterr()
def __eq__(self, other):
a = Output(self.out)