Tests: switching stdout to blocking before printing log.
This is another attempt to fix the following error message: BlockingIOError: [Errno 11] write could not complete without blocking
This commit is contained in:
@@ -407,8 +407,11 @@ class TestUnit(unittest.TestCase):
|
|||||||
print('Path to unit.log:\n' + path + '\n')
|
print('Path to unit.log:\n' + path + '\n')
|
||||||
|
|
||||||
if TestUnit.print_log:
|
if TestUnit.print_log:
|
||||||
|
os.set_blocking(sys.stdout.fileno(), True)
|
||||||
|
sys.stdout.flush()
|
||||||
|
|
||||||
if data is None:
|
if data is None:
|
||||||
with open(path, 'r', encoding='utf-8', errors='ignore') as f:
|
with open(path, 'r', encoding='utf-8', errors='ignore') as f:
|
||||||
data = f.read()
|
shutil.copyfileobj(f, sys.stdout)
|
||||||
|
else:
|
||||||
print(data)
|
sys.stdout.write(data)
|
||||||
|
|||||||
Reference in New Issue
Block a user