mirror of
				https://github.com/ansible-collections/community.general.git
				synced 2025-10-24 21:14:00 -07:00 
			
		
		
		
	Adding aliases for field attributes and renaming async attribute (#33141)
* Adding aliases for field attributes and renaming async attribute As of Python 3.7, the use of async raises an error, whereas before the use of the reserved word was ignored. This adds an alias field for field attrs so that both async and async_val (interally) work. This allows us to be backwards-compatible with 3rd party plugins that may still reference Task.async, but for the core engine to work on Py3.7+. * Remove files fixed for 'async' usage from the python 3.7 skip list
This commit is contained in:
		
					parent
					
						
							
								23f8833e87
							
						
					
				
			
			
				commit
				
					
						d8ae4dfbf2
					
				
			
		
					 14 changed files with 43 additions and 36 deletions
				
			
		|  | @ -75,12 +75,12 @@ class TestActionBase(unittest.TestCase): | |||
| 
 | ||||
|         play_context = PlayContext() | ||||
| 
 | ||||
|         mock_task.async = None | ||||
|         mock_task.async_val = None | ||||
|         action_base = DerivedActionBase(mock_task, mock_connection, play_context, None, None, None) | ||||
|         results = action_base.run() | ||||
|         self.assertEqual(results, dict()) | ||||
| 
 | ||||
|         mock_task.async = 0 | ||||
|         mock_task.async_val = 0 | ||||
|         action_base = DerivedActionBase(mock_task, mock_connection, play_context, None, None, None) | ||||
|         results = action_base.run() | ||||
|         self.assertEqual(results, {}) | ||||
|  | @ -92,7 +92,7 @@ class TestActionBase(unittest.TestCase): | |||
|         # create our fake task | ||||
|         mock_task = MagicMock() | ||||
|         mock_task.action = "copy" | ||||
|         mock_task.async = 0 | ||||
|         mock_task.async_val = 0 | ||||
| 
 | ||||
|         # create a mock connection, so we don't actually try and connect to things | ||||
|         mock_connection = MagicMock() | ||||
|  |  | |||
|  | @ -43,7 +43,7 @@ class TestCopyResultExclude(unittest.TestCase): | |||
| 
 | ||||
|         play_context = Mock() | ||||
|         task = MagicMock(Task) | ||||
|         task.async = False | ||||
|         task.async_val = False | ||||
|         connection = Mock() | ||||
| 
 | ||||
|         task.args = {'_raw_params': 'Args1'} | ||||
|  | @ -60,7 +60,7 @@ class TestCopyResultExclude(unittest.TestCase): | |||
| 
 | ||||
|         play_context = Mock() | ||||
|         task = MagicMock(Task) | ||||
|         task.async = False | ||||
|         task.async_val = False | ||||
|         connection = Mock() | ||||
| 
 | ||||
|         task.args = {'_raw_params': 'Args1'} | ||||
|  | @ -75,7 +75,7 @@ class TestCopyResultExclude(unittest.TestCase): | |||
| 
 | ||||
|         play_context = Mock() | ||||
|         task = MagicMock(Task) | ||||
|         task.async = False | ||||
|         task.async_val = False | ||||
|         connection = Mock() | ||||
| 
 | ||||
|         task.args = {'_raw_params': 'Args1'} | ||||
|  | @ -92,7 +92,7 @@ class TestCopyResultExclude(unittest.TestCase): | |||
| 
 | ||||
|         play_context = Mock() | ||||
|         task = MagicMock(Task) | ||||
|         task.async = False | ||||
|         task.async_val = False | ||||
|         connection = Mock() | ||||
| 
 | ||||
|         task.args = {'_raw_params': 'Args1'} | ||||
|  |  | |||
|  | @ -46,7 +46,7 @@ class TaskMock(object): | |||
|     args = {'src': u'/tmp/deleteme', | ||||
|             'dest': '/tmp/deleteme', | ||||
|             'rsync_path': 'rsync'} | ||||
|     async = None | ||||
|     async_val = None | ||||
|     become = None | ||||
|     become_user = None | ||||
|     become_method = None | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue