def test_with_pkg_resources(self): with patch('pkg_resources.iter_entry_points', create=True) as iterep: eps = iterep.return_value = [Mock(), Mock()] assert list(entrypoints('kombu.test')) iterep.assert_called_with('kombu.test') eps[0].load.assert_called_with() eps[1].load.assert_called_with()
def test_entrypoints(): with patch('kombu.utils.compat.importlib_metadata.entry_points', create=True) as iterep: eps = [Mock(), Mock()] iterep.return_value = {'kombu.test': eps} assert list(entrypoints('kombu.test')) iterep.assert_called_with() eps[0].load.assert_called_with() eps[1].load.assert_called_with()
def test_without_pkg_resources(self): assert list(entrypoints('kombu.test')) == []
def test_without_pkg_resources(self): self.assertListEqual(list(entrypoints('kombu.test')), [])