Skip to content

Commit

Permalink
append timer to test
Browse files Browse the repository at this point in the history
  • Loading branch information
signedav committed Nov 30, 2023
1 parent 8ce9e06 commit fbb6382
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion tests/test_ilicache.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os
import pathlib

from qgis.PyQt.QtCore import Qt
from qgis.PyQt.QtCore import QEventLoop, Qt, QTimer
from qgis.testing import unittest

from modelbaker.iliwrapper.ili2dbconfig import BaseConfiguration
Expand Down Expand Up @@ -361,6 +361,8 @@ def test_ilidata_xml_parser_metaconfig_kbs(self):
}
assert metaconfigs == expected_metaconfigs

self._sleep()

ilimetaconfigcache_model = ilimetaconfigcache.model

matches_on_id = ilimetaconfigcache_model.match(
Expand Down Expand Up @@ -439,6 +441,8 @@ def test_ilidata_xml_parser_local_repo_metaconfig(self):
}
assert metaconfigs == expected_metaconfigs

self._sleep()

ilimetaconfigcache_model = ilimetaconfigcache.model

matches_on_id = ilimetaconfigcache_model.match(
Expand Down Expand Up @@ -510,6 +514,8 @@ def test_ilidata_xml_parser_linkedmodels(self):
}
assert referencedata == expected_referencedata

self._sleep()

linked_model_list = []
for r in range(ilireferencedatacache.model.rowCount()):
if ilireferencedatacache.model.item(r).data(
Expand Down Expand Up @@ -563,6 +569,8 @@ def test_ilidata_xml_parser_local_repo_linkedmodels(self):
}
assert referencedata == expected_referencedata

self._sleep()

linked_model_list = []
for r in range(ilireferencedatacache.model.rowCount()):
if ilireferencedatacache.model.item(r).data(
Expand Down Expand Up @@ -617,6 +625,8 @@ def test_ilidata_xml_parser_toppingfiles(self):

assert files == expected_files

self._sleep()

ilitoppingfilecache_model = ilitoppingfilecache.model

matches_on_id = ilitoppingfilecache_model.match(
Expand Down Expand Up @@ -765,3 +775,11 @@ def test_ilidata_xml_parser_invalid(self):
# not finding invalid metaconfig but the one with none as id
expected_metaconfigs = {None, "ch.opengis.ili.config.valid"}
assert metaconfigs == expected_metaconfigs

def _sleep(self, mili=1000):
loop = QEventLoop()
timer = QTimer()
timer.setSingleShot(True)
timer.timeout.connect(lambda: loop.quit())
timer.start(mili)
loop.exec()

0 comments on commit fbb6382

Please sign in to comment.