Constraining runtime selection and behavior to improve local testing stability
New issues were encountered during unit test execution on local machines, caused by introduction of new runtime and unexpected mock behavior. Patch limits the test execution enviornmnet to Python3.8, while removing offending autospecced mocks from unit tests. Closes-Bug: #1982750 Signed-off-by: Jiri Podivin <jpodivin@redhat.com> Change-Id: I67e7e594cb1aa4f6043c1ca1869828efc7f119b5
This commit is contained in:
parent
5076004733
commit
b191190a6b
1
tox.ini
1
tox.ini
@ -30,6 +30,7 @@ deps =
|
||||
-r {toxinidir}/test-requirements.txt
|
||||
-r {toxinidir}/doc/requirements.txt
|
||||
whitelist_externals = bash
|
||||
basepython = python3.8
|
||||
|
||||
[testenv:bindep]
|
||||
# Do not install any requirements. We want this to be fast and work even if
|
||||
|
@ -99,11 +99,9 @@ class TestValidationJson(base.BaseTestCase):
|
||||
|
||||
@mock.patch(
|
||||
'ansible.playbook.play.Play._uuid',
|
||||
autospec=True,
|
||||
return_value='bar')
|
||||
@mock.patch(
|
||||
'ansible.playbook.play.Play.get_name',
|
||||
autospec=True,
|
||||
return_value='foo')
|
||||
@mock.patch('ansible.playbook.play.Play')
|
||||
def test_new_play(self, mock_play, mock_play_name, mock_play_uuid):
|
||||
@ -117,7 +115,7 @@ class TestValidationJson(base.BaseTestCase):
|
||||
callback.env['playbook_path'] = 'buzz/fizz'
|
||||
play_dict = callback._new_play(mock_play)
|
||||
mock_play_name.assert_called_once()
|
||||
mock_play_uuid.assert_called_once()
|
||||
mock_play_uuid.__str__.assert_called_once()
|
||||
"""
|
||||
Callback time sanity check only verifies general format
|
||||
of the stored time to be iso format `YYYY-MM-DD HH:MM:SS.mmmmmm`
|
||||
@ -130,11 +128,9 @@ class TestValidationJson(base.BaseTestCase):
|
||||
|
||||
@mock.patch(
|
||||
'ansible.playbook.task.Task._uuid',
|
||||
autospec=True,
|
||||
return_value='bar')
|
||||
@mock.patch(
|
||||
'ansible.playbook.task.Task.get_name',
|
||||
autospec=True,
|
||||
return_value='foo')
|
||||
@mock.patch('ansible.playbook.task.Task')
|
||||
def test_new_task(self, mock_task, mock_task_name, mock_task_uuid):
|
||||
@ -146,7 +142,7 @@ class TestValidationJson(base.BaseTestCase):
|
||||
callback = vf_validation_json.CallbackModule()
|
||||
task_dict = callback._new_task(mock_task)
|
||||
mock_task_name.assert_called_once()
|
||||
mock_task_uuid.assert_called_once()
|
||||
mock_task_uuid.__str__.assert_called_once()
|
||||
"""
|
||||
Callback time sanity check only verifies general format
|
||||
of the stored time to be iso format `YYYY-MM-DD HH:MM:SS.mmmmmm`
|
||||
|
@ -99,11 +99,9 @@ class TestValidationStdout(base.BaseTestCase):
|
||||
|
||||
@mock.patch(
|
||||
'ansible.playbook.play.Play._uuid',
|
||||
autospec=True,
|
||||
return_value='bar')
|
||||
@mock.patch(
|
||||
'ansible.playbook.play.Play.get_name',
|
||||
autospec=True,
|
||||
return_value='foo')
|
||||
@mock.patch('ansible.playbook.play.Play')
|
||||
def test_new_play(self, mock_play, mock_play_name, mock_play_uuid):
|
||||
@ -119,7 +117,7 @@ class TestValidationStdout(base.BaseTestCase):
|
||||
play_dict = callback._new_play(mock_play)
|
||||
|
||||
mock_play_name.assert_called_once()
|
||||
mock_play_uuid.assert_called_once()
|
||||
mock_play_uuid.__str__.called_once()
|
||||
|
||||
"""
|
||||
Callback time sanity check only verifies general format
|
||||
@ -134,11 +132,9 @@ class TestValidationStdout(base.BaseTestCase):
|
||||
|
||||
@mock.patch(
|
||||
'ansible.playbook.task.Task._uuid',
|
||||
autospec=True,
|
||||
return_value='bar')
|
||||
@mock.patch(
|
||||
'ansible.playbook.task.Task.get_name',
|
||||
autospec=True,
|
||||
return_value='foo')
|
||||
@mock.patch('ansible.playbook.task.Task')
|
||||
def test_new_task(self, mock_task, mock_task_name, mock_task_uuid):
|
||||
@ -151,7 +147,7 @@ class TestValidationStdout(base.BaseTestCase):
|
||||
task_dict = callback._new_task(mock_task)
|
||||
|
||||
mock_task_name.assert_called_once()
|
||||
mock_task_uuid.assert_called_once()
|
||||
mock_task_uuid.__str__.assert_called_once()
|
||||
|
||||
"""
|
||||
Callback time sanity check only verifies general format
|
||||
|
Loading…
x
Reference in New Issue
Block a user