Once the debugger is attached, click suspend button to suspend the process execution, otherwise it just continues. Be warned, that there are two python processes, wrapper and the C Python process. In meantime go to MSVS and attach the debugger to python process. To debug, just put a sleep time in your python code, make sure it is say 60 seconds (If you are mst_ then 10 may be enough -) Debugging python unit tests is not an exception here. (gdb) source /usr/share/gdb/python/gdb/libpython.pyĪs always life on Windows is different. Source the gdb python extension (needed only on OpenSUSE): Import test_get_expression_veto_read_only(self): Put this in your unit test (sw/qa/unoapi/python/get_expression.py): Until we have this hook up and running in upstream python: Make PythonTest_sw_python GDBCPPUNITTRACE="gdb -args" Note: debug repo must be activated (in yast) Sudo zypper in python3-base-debuginfo python3-devel-debuginfo libpython3_3m1_0-debuginfo make PythonTest_pyuno_pytests_testcollections"ĭebug python unit test on Linux Prerequisites Fedora.Running python unit tests All tests of a module Note: the tests defined in this way are running during subsequentcheck phase (also on Tinderboxes that activated it). $(eval $(call gb_Module_add_subsequentcheck_targets,sw,\ py and /PythonTest_ _python.mk as explained avobe. If no python unit test is defined for a module, you should create /qa/python/. Note: For pyuno tests, use instead pyuno/PythonTest_pyuno_pytests_ For new modules $(eval $(call gb_PythonTest_add_modules,sw_python,$(SRCDIR)/sw/qa/python,\ $(eval $(call gb_PythonTest_PythonTest,sw_python)) Note: For pyuno tests, use instead pyuno/qa/pytests/.py Add the test to /PythonTest_ _python.mk: Self.assertEqual(content, xTextField.getPropertyValue("Content")) XBodyText.insertTextContent(xCursor, xTextField, True)Ĭontent = "Say hello from Python unit test!" XTextField = xDoc.createInstance(".TextField.Input") XDoc = self._class_._uno.openEmptyWriterDoc() # copy here a header from the file in the root of the source tree.įrom import UnoInProcess In the following, the paths are given relative to the folder containing LibreOffice sources. (You can get an up-to-date list with grep -exclude-dir="instdir" -exclude-dir="workdir" -exclude-dir=".git" -exclude-dir='autom4te.cache' -iRl "PythonTest" | grep ".mk") Python unit tests are seamlessly supported al least in the following modules : The Python based UI tests are documented on their own page. This page explains the Python tests used inside of LibreOffice code.
0 Comments
Leave a Reply. |