Skip to content

Instantly share code, notes, and snippets.

@apua
Last active October 28, 2024 07:51
Show Gist options
  • Save apua/e0395b28c5805e55425097f5d5c5cf6b to your computer and use it in GitHub Desktop.
Save apua/e0395b28c5805e55425097f5d5c5cf6b to your computer and use it in GitHub Desktop.
Disable output capturing by Robot Framework
"""
The alternative of entry point from `robot`, aims to disable output
capturing in order to make it display everything as usual, while we
usually run single FPGA emulation rather than multiple.
Following are included in this entry point.
0. Implicitly export Python library search path for `Library`.
1. Disable `robot` logger handler "inception" and output capturer
by monkey patching.
2. Set up logger then run `robot` CLI.
"""
from robot.output import pyloggingconf
@pyloggingconf.contextmanager
def robot_handler_enabled(level): yield
pyloggingconf.robot_handler_enabled = robot_handler_enabled
from robot.running.outputcapture import StreamCapturer
StreamCapturer.__init__ = lambda self, stdout=None: None
StreamCapturer.release = lambda self: ''
#import env_logger
#env_logger.basicConfig()
from robot.run import run_cli
run_cli()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment