mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Bugfix/ fix mocker patch in tests (#52372)
* 🐛 Fix invalid os.stat mock in tests * 🐛 Fix leaking mock patch in tests Closes #52347
This commit is contained in:
parent
b4802350ec
commit
f1e67c3328
2 changed files with 4 additions and 1 deletions
|
@ -197,7 +197,7 @@ def test_rename_perms_fail_temp_succeeds(atomic_am, atomic_mocks, fake_stat, moc
|
|||
mock_context = atomic_am.selinux_default_context.return_value
|
||||
atomic_mocks['path_exists'].return_value = False
|
||||
atomic_mocks['rename'].side_effect = [OSError(errno.EPERM, 'failing with EPERM'), None]
|
||||
atomic_mocks['stat'].return_value = [fake_stat, fake_stat, fake_stat]
|
||||
atomic_mocks['stat'].return_value = fake_stat
|
||||
atomic_mocks['stat'].side_effect = None
|
||||
atomic_mocks['mkstemp'].return_value = (None, '/path/to/tempfile')
|
||||
atomic_mocks['mkstemp'].side_effect = None
|
||||
|
|
|
@ -151,3 +151,6 @@ def test_missing_lchmod_is_link(am, mock_stats, mocker, check_mode):
|
|||
assert not m_chmod.called
|
||||
else:
|
||||
m_chmod.assert_called_with(b'/path/to/file/no_lchmod', 0o660)
|
||||
|
||||
mocker.resetall()
|
||||
mocker.stopall()
|
||||
|
|
Loading…
Reference in a new issue