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:
James Cammarata 2017-11-22 14:35:58 -06:00 committed by Matt Clay
parent 23f8833e87
commit d8ae4dfbf2
14 changed files with 43 additions and 36 deletions

View file

@ -370,11 +370,11 @@ class TestTaskExecutor(unittest.TestCase):
mock_task.changed_when = None
mock_task.failed_when = None
mock_task.post_validate.return_value = None
# mock_task.async cannot be left unset, because on Python 3 MagicMock()
# mock_task.async_val cannot be left unset, because on Python 3 MagicMock()
# > 0 raises a TypeError There are two reasons for using the value 1
# here: on Python 2 comparing MagicMock() > 0 returns True, and the
# other reason is that if I specify 0 here, the test fails. ;)
mock_task.async = 1
mock_task.async_val = 1
mock_task.poll = 0
mock_play_context = MagicMock()
@ -431,7 +431,7 @@ class TestTaskExecutor(unittest.TestCase):
mock_host = MagicMock()
mock_task = MagicMock()
mock_task.async = 0.1
mock_task.async_val = 0.1
mock_task.poll = 0.05
mock_play_context = MagicMock()