From 6ee97db88eec6ec3baa0c0a9f9d05ea7ae08b305 Mon Sep 17 00:00:00 2001 From: Asko Soukka Date: Sat, 7 May 2022 19:34:31 +0300 Subject: [PATCH] Try to ensure that WSGI server has stopped before returning from TestScopeWSGIServer testTearDown --- src/plone/app/robotframework/testing.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/plone/app/robotframework/testing.py b/src/plone/app/robotframework/testing.py index 8e1a7d9..aef7bcc 100644 --- a/src/plone/app/robotframework/testing.py +++ b/src/plone/app/robotframework/testing.py @@ -156,6 +156,12 @@ def tearDown(self): def testTearDown(self): super(TestScopeWSGIServer, self).tearDown() + # Try to wait until server no longer responds. + if hasattr(self, "server"): + for i in range(10): + # There is implicit 0.3 second sleep per try. + if not self.server.wait(0): + return TEST_SCOPE_WSGI_SERVER_FIXTURE = TestScopeWSGIServer()