Skip to content

Commit

Permalink
[ci] Fix intermittent QGIS test failures. (#939)
Browse files Browse the repository at this point in the history
Long story short, we did a `sleep 10` to wait for the container to be
ready. I removed it, and now start a displayserver (`xvfb-run -a`,
separate from the container one) as part of the test, which seems to be
much more reliable.
  • Loading branch information
evetion authored Jan 15, 2024
1 parent eb21b63 commit 197f6f0
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions .docker/compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ services:
environment:
- CI=true
- DISPLAY=:99
tty: true
2 changes: 0 additions & 2 deletions .docker/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ set -euxo pipefail
source .env

docker compose -f compose.yml up -d --force-recreate --remove-orphans
echo "Wait 10 seconds"
sleep 10
echo "Installation of the plugin Ribasim"
docker exec -t qgis sh -c "qgis_setup.sh ${PLUGIN_NAME}"
echo "Containers are running"
2 changes: 1 addition & 1 deletion .docker/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ set -euxo pipefail

source .env

docker exec -t qgis sh -c "cd /tests_directory && qgis_testrunner.sh ${PLUGIN_NAME}.tests"
docker exec -t qgis sh -c "cd /tests_directory && xvfb-run -a qgis_testrunner.sh ${PLUGIN_NAME}.tests"
3 changes: 3 additions & 0 deletions ribasim_qgis/tests/test_load_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@

class TestPlugin(unittest.TestCase):
def test_plugin_is_loaded(self):
"""Test plugin is properly loaded and appears in QGIS plugins."""
plugin = plugins.get("ribasim_qgis")
self.assertTrue(plugin, "Ribasim plugin not loaded")


class TestDock(unittest.TestCase):
def test_load_dock(self):
"""Triggers Ribasim button and checks that Dock is added"""

Expand Down

0 comments on commit 197f6f0

Please sign in to comment.