Closed jmkerloch closed 2 years ago
Hi,
I ran into the same problem, but with @Joonalai help we solved it.
I do not initialize plugins the way you exemplified. I run the same procedure as QGIS does, calling qgis.util
functions. You can check my code at https://github.com/JaumeFigueras/GisFIRE-SpreadSimulation/tree/master/test It is "tuned" to my config of multiple plugins but I think is easy enough to understand. Check the test and the two fixtures I wrote.
Hope this helps.
Thank you for the issue! It seems that the addToolBar
method of QgisInterface
supports also QToolBar
objects as first argument. The stub implementation should be fixed to take this into account.
As a side note, you don't have to initialize QGIS, since it is done automatically.
def test_1loadplugin(qgis_app, qgis_iface): qgis_app.initQgis() plugin = Plugin(qgis_iface) plugin.initGui()
Hi,
I encountered the same problem when I upgraded pytest-qgis to the version 1.3.0.
The problem was not present in version 1.2.0.
Thank you for letting me know, I will fix this ASAP.
Describe the bug I'm using qgis_iface fixture to initialize my plugin
But when I add a toolbar with my plugin I get this error
To Reproduce Steps to reproduce the behavior:
self.iface.addToolBar(self.new_toolbar)
Expected behavior qgis_iface fixture should allow mocking of toolbar add.
Environment (please complete the following information):
Additional context I have upgraded my pytest-qgis installation with new version 1.3.0