How to write a functional test for a DBUS service written in Python?

前端 未结 6 1599
忘掉有多难
忘掉有多难 2021-01-02 01:16

(Title was: \"How to write a unit test for a DBUS service written in Python?\")

I\'ve started to write a DBUS service using dbus-python, but I\'m having trouble writ

6条回答
  •  耶瑟儿~
    2021-01-02 02:10

    You just need to make sure you are handling your main loop properly.

    def refresh_ui():
        while gtk.events_pending():
           gtk.main_iteration_do(False)
    

    This will run the gtk main loop until it has finished processing everything, rather than just run it and block.

    For a complete example of it in practise, unit testing a dbus interface, go here: http://pida.co.uk/trac/browser/pida/editors/vim/test_pidavim.py

提交回复
热议问题