tests: fix events tests on python3.7
Fix syntax workaround for python3.7 + python2.7. This code can't use 'yield from' to be still importable on python2.7, but asyncio.sleep() is no longer iterable on python3.7. Workaround it by manually calling coroutine.send(None) in a loop - ugly as hell, but works. I can't wait until we could drop python2 support...
This commit is contained in:
		
							parent
							
								
									291382c6b9
								
							
						
					
					
						commit
						21569b3a31
					
				@ -107,7 +107,8 @@ class TC_00_Events(qubesadmin.tests.QubesTestCase):
 | 
				
			|||||||
        for event in events:
 | 
					        for event in events:
 | 
				
			||||||
            stream.feed_data(event)
 | 
					            stream.feed_data(event)
 | 
				
			||||||
            # don't use yield from...
 | 
					            # don't use yield from...
 | 
				
			||||||
            for x in asyncio.sleep(0.01):
 | 
					            sleep = asyncio.sleep(0.01)
 | 
				
			||||||
 | 
					            for x in iter(lambda: sleep.send(None), None):
 | 
				
			||||||
                yield x
 | 
					                yield x
 | 
				
			||||||
        stream.feed_eof()
 | 
					        stream.feed_eof()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user