From 01f12221ad21df89229bba2084e5e9a8f81a8e46 Mon Sep 17 00:00:00 2001 From: Nyall Dawson Date: Mon, 8 May 2017 12:03:46 +1000 Subject: [PATCH] Fix intermittent QgsMapLayerStore test failure --- tests/src/python/test_qgsmaplayerstore.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/src/python/test_qgsmaplayerstore.py b/tests/src/python/test_qgsmaplayerstore.py index 7fa24e14d20..8924235ec8a 100644 --- a/tests/src/python/test_qgsmaplayerstore.py +++ b/tests/src/python/test_qgsmaplayerstore.py @@ -17,6 +17,7 @@ from qgis.testing import start_app, unittest from qgis.PyQt.QtCore import QT_VERSION_STR import sip from qgis.PyQt.QtTest import QSignalSpy +from time import sleep start_app() @@ -201,7 +202,11 @@ class TestQgsMapLayerStore(unittest.TestCase): self.assertEqual(store.mapLayersByName('test2'), [l2]) #duplicate name + + # 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 + sleep(0.1) l3 = createLayer('test') + store.addMapLayer(l3) self.assertEqual(set(store.mapLayersByName('test')), {l1, l3})