We've encountered a bug when doctest.DocTestFinder().find() is used with ramlient.Client.
coala/corobo#616 is example of enabling pytest --doctest-modules and
https://travis-ci.org/coala/corobo/builds/416950463 shows the failure.
It makes no difference which .raml is loaded; any variable wih an instance of Client will trigger it.
Here is a simplified case.
$ wget https://raw.githubusercontent.com/coala/corobo/master/webservices.raml
$ echo 'from ramlient import Client; client=Client("webservices.raml")' > doctest_bug.py
$ PYTHONPATH=. python3
>>> import doctest_bug
>>> import doctest
>>> finder = doctest.DocTestFinder()
>>> finder.find(import_ramlient)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib64/python3.7/doctest.py", line 933, in find
self._find(tests, obj, name, module, source_lines, globs, {})
File "/usr/lib64/python3.7/doctest.py", line 996, in _find
if ((inspect.isroutine(inspect.unwrap(val))
File "/usr/lib64/python3.7/inspect.py", line 511, in unwrap
while _is_wrapper(func):
File "/usr/lib64/python3.7/inspect.py", line 502, in _is_wrapper
return hasattr(f, '__wrapped__')
File "/home/jayvdb/.local/lib/python3.7/site-packages/ramlient/core.py", line 132, in __getattr__
raise ResourceNotFoundError(attr)
ramlient.errors.ResourceNotFoundError: No such Resource found: __wrapped__
https://docs.python.org/3/library/inspect.html#inspect.unwrap was added in Python 3.4 , but it wasnt used in doctest (&pydoc) until Python 3.5. python/cpython@b532df62b9
I guess it is a fairly simply thing to workaround in __getattr__. We'll submit a patch shortly.
We've encountered a bug when
doctest.DocTestFinder().find()is used withramlient.Client.coala/corobo#616 is example of enabling
pytest --doctest-modulesandhttps://travis-ci.org/coala/corobo/builds/416950463 shows the failure.
It makes no difference which .raml is loaded; any variable wih an instance of
Clientwill trigger it.Here is a simplified case.
https://docs.python.org/3/library/inspect.html#inspect.unwrap was added in Python 3.4 , but it wasnt used in doctest (&pydoc) until Python 3.5. python/cpython@b532df62b9
I guess it is a fairly simply thing to workaround in
__getattr__. We'll submit a patch shortly.