Dear Community,
I would like to run Doctests within Python. I created a simple testClass to describe my problem:
class testClass:
"""
>>> import sys
>>> render = "paraview.simple" in sys.modules
>>> if render:
... print("ParaVIEW available.")
"""
def __init__( self ) -> None:
pass
def testAndShow():
import testClass
import doctest
doctest.testmod(
m=testClass,
name=__name__,
verbose=True
)
Then I would like to run ParaVIEW and execute the following within the Python shell:
>>> from paraview.simple import *
>>> from testClass import *
>>> testAndShow()
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/home/ati/tmp/dtOO-application/pythonOO/testClass.py", line 26, in testAndShow
verbose=True
File "/usr/lib64/python3.6/doctest.py", line 1951, in testmod
runner.run(test)
File "/usr/lib64/python3.6/doctest.py", line 1445, in run
encoding = save_stdout.encoding
AttributeError: 'vtkPythonStdStreamCaptureHelper' object has no attribute 'encoding'
So, what’S my mistake?
Thank you for your support.