mirror of
				https://git.kernel.org/pub/scm/network/wireless/iwd.git
				synced 2025-11-04 00:37:22 +01:00 
			
		
		
		
	auto-t: ead.py: remove wait_for_object_condition
Instead the class method IWD._wait_for_object_condition can be used.
This commit is contained in:
		
							parent
							
								
									382b73c11a
								
							
						
					
					
						commit
						365f955318
					
				@ -22,10 +22,10 @@ class Test(unittest.TestCase):
 | 
			
		||||
        adapter = ead.list_adapters(1)[0]
 | 
			
		||||
 | 
			
		||||
        condition = 'obj.connected == True'
 | 
			
		||||
        ead.wait_for_object_condition(adapter, condition)
 | 
			
		||||
        IWD._wait_for_object_condition(adapter, condition)
 | 
			
		||||
 | 
			
		||||
        condition = 'obj.authenticated == True'
 | 
			
		||||
        ead.wait_for_object_condition(adapter, condition)
 | 
			
		||||
        IWD._wait_for_object_condition(adapter, condition)
 | 
			
		||||
 | 
			
		||||
        ctx.stop_process(p)
 | 
			
		||||
    @classmethod
 | 
			
		||||
 | 
			
		||||
@ -103,22 +103,3 @@ class EAD(iwd.AsyncOpAbstract):
 | 
			
		||||
                            exception=TimeoutError('EAD has no associated devices'))
 | 
			
		||||
 | 
			
		||||
        return list(self._adapters.values())
 | 
			
		||||
 | 
			
		||||
    def wait_for_object_condition(self, obj, condition_str, max_wait = 50):
 | 
			
		||||
        self._wait_timed_out = False
 | 
			
		||||
        def wait_timeout_cb():
 | 
			
		||||
            self._wait_timed_out = True
 | 
			
		||||
            return False
 | 
			
		||||
 | 
			
		||||
        try:
 | 
			
		||||
            timeout = GLib.timeout_add_seconds(max_wait, wait_timeout_cb)
 | 
			
		||||
            context = ctx.mainloop.get_context()
 | 
			
		||||
            while not eval(condition_str):
 | 
			
		||||
                context.iteration(may_block=True)
 | 
			
		||||
                if self._wait_timed_out and ctx.args.gdb == None:
 | 
			
		||||
                    raise TimeoutError('[' + condition_str + ']'\
 | 
			
		||||
                                       ' condition was not met in '\
 | 
			
		||||
                                       + str(max_wait) + ' sec')
 | 
			
		||||
        finally:
 | 
			
		||||
            if not self._wait_timed_out:
 | 
			
		||||
                GLib.source_remove(timeout)
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user