Skip to content

Commit 01f1222

Browse files
committed
Fix intermittent QgsMapLayerStore test failure
1 parent 9ee9df7 commit 01f1222

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

tests/src/python/test_qgsmaplayerstore.py

+5
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
from qgis.PyQt.QtCore import QT_VERSION_STR
1818
import sip
1919
from qgis.PyQt.QtTest import QSignalSpy
20+
from time import sleep
2021

2122
start_app()
2223

@@ -201,7 +202,11 @@ def test_mapLayersByName(self):
201202
self.assertEqual(store.mapLayersByName('test2'), [l2])
202203

203204
#duplicate name
205+
206+
# little bit of a hack - we don't want a duplicate ID and since IDs are currently based on time we wait a bit here
207+
sleep(0.1)
204208
l3 = createLayer('test')
209+
205210
store.addMapLayer(l3)
206211
self.assertEqual(set(store.mapLayersByName('test')), {l1, l3})
207212

0 commit comments

Comments
 (0)