GispoCoding / cookiecutter-qgis-plugin

A QGIS Plugin template to be set up with Cookiecutter
MIT License
24 stars 4 forks source link

Tests failing: fixture 'qtbot' not found #57

Open angusmcb opened 3 months ago

angusmcb commented 3 months ago

Describe the bug From a fresh install of the cookiecutter, tests are failing. There are 16 errors.


======================================================================= short test summary info ========================================================================
ERROR wntrqgis/qgis_plugin_tools/test/ui/test_progress_dialog.py::test_progress_bar_dialog[True]
ERROR wntrqgis/qgis_plugin_tools/test/ui/test_progress_dialog.py::test_progress_bar_dialog[False]
ERROR wntrqgis/qgis_plugin_tools/test/ui/test_progress_dialog.py::test_create_simple_continuous_progress_dialog[True]
ERROR wntrqgis/qgis_plugin_tools/test/ui/test_progress_dialog.py::test_create_simple_continuous_progress_dialog[False]
ERROR wntrqgis/qgis_plugin_tools/test/ui/test_progress_dialog.py::test_run_task_with_progress_dialog[True-True-True]
ERROR wntrqgis/qgis_plugin_tools/test/ui/test_progress_dialog.py::test_run_task_with_progress_dialog[True-True-False]
ERROR wntrqgis/qgis_plugin_tools/test/ui/test_progress_dialog.py::test_run_task_with_progress_dialog[True-False-True]
ERROR wntrqgis/qgis_plugin_tools/test/ui/test_progress_dialog.py::test_run_task_with_progress_dialog[True-False-False]
ERROR wntrqgis/qgis_plugin_tools/test/ui/test_progress_dialog.py::test_run_task_with_progress_dialog[False-True-True]
ERROR wntrqgis/qgis_plugin_tools/test/ui/test_progress_dialog.py::test_run_task_with_progress_dialog[False-True-False]
ERROR wntrqgis/qgis_plugin_tools/test/ui/test_progress_dialog.py::test_run_task_with_progress_dialog[False-False-True]
ERROR wntrqgis/qgis_plugin_tools/test/ui/test_progress_dialog.py::test_run_task_with_progress_dialog[False-False-False]
ERROR wntrqgis/qgis_plugin_tools/test/ui/test_progress_dialog.py::test_run_task_with_continuous_progress_dialog_failure[True-True]
ERROR wntrqgis/qgis_plugin_tools/test/ui/test_progress_dialog.py::test_run_task_with_continuous_progress_dialog_failure[True-False]
ERROR wntrqgis/qgis_plugin_tools/test/ui/test_progress_dialog.py::test_run_task_with_continuous_progress_dialog_failure[False-True]
ERROR wntrqgis/qgis_plugin_tools/test/ui/test_progress_dialog.py::test_run_task_with_continuous_progress_dialog_failure[False-False]

All have a similar error:

___________________________________________________________ ERROR at setup of test_progress_bar_dialog[True] ___________________________________________________________
file /home/me/coding/qgis-plugin/qgisplugin/qgis_plugin_tools/test/ui/test_progress_dialog.py, line 16
  @pytest.mark.parametrize("show_abort_btn", [True, False])
  def test_progress_bar_dialog(qtbot, show_abort_btn):
E       fixture 'qtbot' not found
>       available fixtures: another_file_fixture, cache, capfd, capfdbinary, caplog, capsys, capsysbinary, cov, doctest_namespace, file_fixture, initialize_logger, monkeypatch, no_cover, pytestconfig, qgis_app, qgis_bot, qgis_canvas, qgis_countries_layer, qgis_iface, qgis_new_project, qgis_parent, qgis_processing, qgis_show_map, qgis_version, qgis_world_map_geopackage, record_property, record_testsuite_property, record_xml_attribute, recwarn, task_runner, tmp_path, tmp_path_factory, tmpdir, tmpdir_factory
>       use 'pytest --fixtures [testpath]' for help on them.

To Reproduce Steps to reproduce the behavior:

  1. cookiecutter https://github.com/GispoCoding/cookiecutter-qgis-plugin
  2. setup as per instructions:
    cd wntr-qgis                                                                    
    python create_qgis_venv.py                                                      
    source .venv/bin/activate                                                       
    python -m pip install -U pip                                                    
    pip install pip-tools                                                           
    pip-compile requirements-dev.in                                                 
    pip install -r requirements-dev.txt  
  3. pytest

Expected behavior Test should pass

Environment (please complete the following information):

angusmcb commented 3 months ago

I just got all the tests to pass (with some warnings) by installing the following: pytest-timeout pytest-qt pytest-mock

I guess these should be added to the dependencies?