Adapt the mock to correctly mock the behaviors as implemented on Python 3.10. Ref #1663.

This commit is contained in:
Jason R. Coombs 2023-03-12 10:59:27 -04:00 committed by Asif Saif Uddin
parent 35f24f1f01
commit c310364cc0
1 changed files with 6 additions and 2 deletions

View File

@ -16,10 +16,14 @@ def test_entrypoints():
'kombu.utils.compat.importlib_metadata.entry_points', create=True
) as iterep:
eps = [Mock(), Mock()]
iterep.return_value = {'kombu.test': eps}
iterep.return_value = (
{'kombu.test': eps} if sys.version_info < (3, 10) else eps)
assert list(entrypoints('kombu.test'))
iterep.assert_called_with()
if sys.version_info < (3, 10):
iterep.assert_called_with()
else:
iterep.assert_called_with(group='kombu.test')
eps[0].load.assert_called_with()
eps[1].load.assert_called_with()