[CLN] coverage-report: add no cover for unreachable code

This commit is contained in:
Benedek Racz 2020-02-29 18:55:19 +01:00
parent c5ded637ce
commit 0473d4b3e9

View File

@ -117,8 +117,9 @@ class ConsoleReaderBase:
win32console.SetConsoleOutputCP(codepage) win32console.SetConsoleOutputCP(codepage)
logger.info( logger.info(
"Console output code page: %s" % ctypes.windll.kernel32.GetConsoleOutputCP()) "Console output code page: %s" % ctypes.windll.kernel32.GetConsoleOutputCP())
except Exception as e: except Exception as e: # pragma: no cover
logger.info(e) # I hope this code is unreachable...
logger.error(e)
try: try:
self.create_connection(**kwargs) self.create_connection(**kwargs)
@ -132,8 +133,9 @@ class ConsoleReaderBase:
logger.info(f'Child pid: {self.child_pid} Console pid: {self.console_pid}') logger.info(f'Child pid: {self.child_pid} Console pid: {self.console_pid}')
except Exception: except Exception: # pragma: no cover
logger.info(traceback.format_exc()) # I hope this code is unreachable...
logger.error(traceback.format_exc())
return return
if interact: if interact:
@ -141,9 +143,9 @@ class ConsoleReaderBase:
self.interact() self.interact()
self.read_loop() self.read_loop()
except Exception: except Exception: # pragma: no cover
# I hope this code is unreachable...
logger.error(traceback.format_exc()) logger.error(traceback.format_exc())
time.sleep(.1)
finally: finally:
try: try:
self.terminate_child() self.terminate_child()
@ -153,9 +155,9 @@ class ConsoleReaderBase:
time.sleep(.1) time.sleep(.1)
self.close_connection() self.close_connection()
logger.info('Console finished.') logger.info('Console finished.')
except Exception: except Exception: # pragma: no cover
# I hope this code is unreachable...
logger.error(traceback.format_exc()) logger.error(traceback.format_exc())
time.sleep(.1)
def read_loop(self): def read_loop(self):
paused = False paused = False