quteprocess: Add --qute-delay-start
Allows for some rudimentary debugging of subprocesses.
This commit is contained in:
parent
d31b2e2016
commit
496c14bc9e
|
|
@ -219,7 +219,9 @@ def qapp(qapp):
|
|||
|
||||
def pytest_addoption(parser):
|
||||
parser.addoption('--qute-delay', action='store', default=0, type=int,
|
||||
help="Delay between qutebrowser commands.")
|
||||
help="Delay (in ms) between qutebrowser commands.")
|
||||
parser.addoption('--qute-delay-start', action='store', default=0, type=int,
|
||||
help="Delay (in ms) after qutebrowser process started.")
|
||||
parser.addoption('--qute-profile-subprocs', action='store_true',
|
||||
default=False, help="Run cProfile for subprocesses.")
|
||||
parser.addoption('--qute-backend', action='store',
|
||||
|
|
|
|||
|
|
@ -457,6 +457,21 @@ class QuteProc(testprocess.Process):
|
|||
self.wait_for(category='ipc', module='ipc', function='on_ready_read',
|
||||
message='Read from socket *')
|
||||
|
||||
@contextlib.contextmanager
|
||||
def disable_capturing(self):
|
||||
capmanager = self.request.config.pluginmanager.getplugin("capturemanager")
|
||||
with capmanager.global_and_fixture_disabled():
|
||||
yield
|
||||
|
||||
def _after_start(self):
|
||||
"""Wait before continuing if requested, e.g. for debugger attachment."""
|
||||
delay = self.request.config.getoption('--qute-delay-start')
|
||||
if delay:
|
||||
with self.disable_capturing():
|
||||
print(f"- waiting {delay}ms for quteprocess "
|
||||
f"(PID: {self.proc.processId()})...")
|
||||
time.sleep(delay / 1000)
|
||||
|
||||
def send_ipc(self, commands, target_arg=''):
|
||||
"""Send a raw command to the running IPC socket."""
|
||||
delay = self.request.config.getoption('--qute-delay')
|
||||
|
|
|
|||
Loading…
Reference in New Issue