mirror of
https://github.com/valitydev/salt.git
synced 2024-11-06 16:45:27 +00:00
doc: Fix iterating over the Mock object in Python 3
Building the documentation for salt.modules.snapper fails with Python 3: ``` $ make -C doc html [...] WARNING: [autosummary] failed to import 'salt.modules.snapper': no module named salt.modules.snapper building [mo]: targets for 0 po files that are out of date building [html]: targets for 109 source files that are out of date updating environment: [config changed] 1608 added, 17 changed, 0 removed reading sources... [100%] topics/yaml/index doc/ref/modules/all/index.rst:20: WARNING: failed to import snapper doc/ref/modules/all/index.rst:20: WARNING: toctree references unknown document 'ref/modules/all/snapper' WARNING: autodoc: failed to import module 'salt.modules.snapper'; the following exception was raised: Traceback (most recent call last): File "/usr/lib/python3/dist-packages/sphinx/ext/autodoc/importer.py", line 152, in import_module __import__(modname) File "salt/modules/snapper.py", line 72, in <module> if SNAPPER_DBUS_OBJECT in bus.list_activatable_names(): TypeError: argument of type 'Mock' is not iterable ``` Fix the Mock object to be iterable (as it was intended to). Signed-off-by: Benjamin Drung <benjamin.drung@cloud.ionos.com>
This commit is contained in:
parent
bb2994898c
commit
b973e7aae1
@ -55,9 +55,12 @@ class Mock(object):
|
|||||||
def __iter__(self):
|
def __iter__(self):
|
||||||
return self
|
return self
|
||||||
|
|
||||||
def next(self):
|
def __next__(self):
|
||||||
raise StopIteration
|
raise StopIteration
|
||||||
|
|
||||||
|
# For Python 2
|
||||||
|
next = __next__
|
||||||
|
|
||||||
# pylint: enable=R0903
|
# pylint: enable=R0903
|
||||||
|
|
||||||
MOCK_MODULES = [
|
MOCK_MODULES = [
|
||||||
|
Loading…
Reference in New Issue
Block a user