mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 15:14:23 +01:00
pytest: add test for a plugin which falls over outside a command.
This actually passes fine, but it's an interesting case to test. Fixed-by: Darosior <darosior@protonmail.com> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
31
tests/plugins/fail_by_itself.py
Executable file
31
tests/plugins/fail_by_itself.py
Executable file
@@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env python3
|
||||
from pyln.client import Plugin
|
||||
import os
|
||||
import threading
|
||||
import time
|
||||
|
||||
plugin = Plugin()
|
||||
|
||||
|
||||
class FailThread(threading.Thread):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
self.start()
|
||||
|
||||
def run(self):
|
||||
time.sleep(1)
|
||||
print("Exiting!")
|
||||
os._exit(1)
|
||||
|
||||
|
||||
@plugin.init()
|
||||
def init(options, configuration, plugin):
|
||||
FailThread()
|
||||
|
||||
|
||||
@plugin.method('failcmd')
|
||||
def failcmd(plugin):
|
||||
pass
|
||||
|
||||
|
||||
plugin.run()
|
||||
Reference in New Issue
Block a user