python-dbusmock icon indicating copy to clipboard operation
python-dbusmock copied to clipboard

Add helpers for application testing

Open benzea opened this issue 7 years ago • 1 comments

I am currently working on adding testing to g-c-c and would also like to streamline the code for g-s-d. For this, I worked on the two classes in these commits, and I was wondering whether it might be feasible to merge at least the X11 helper into dbusmock in some form.

benzea avatar Apr 05 '18 13:04 benzea

Example of using both:

import os
import sys
import unittest
import dbusmock

BUILDDIR = os.environ.get('BUILDDIR', os.path.join(os.path.dirname(__file__)))

class PanelTestCase(dbusmock.X11SessionTestCase, dbusmock.GTest):
    g_test_exe = os.path.join(BUILDDIR, 'test-network-panel')

if __name__ == '__main__':
    # avoid writing to stderr
    unittest.main(testRunner=unittest.TextTestRunner(stream=sys.stdout, verbosity=2))

Which runs Xvfb, and the system + session busses to execute each of the tests in the binary separately.

benzea avatar Apr 05 '18 14:04 benzea