ファイルが見つからない場合に IOError を予期する doctest があります。
>>> configParser('conffig.ini') # should not exist
Traceback (most recent call last):
...
IOError: No such file: /homes/ndeklein/workspace/MS/PyMS/conffig.ini
ただし、これを別の PC からテストしたい場合、または他の人がテストしたい場合、パスは /homes/ndeklein/workspace/MS/PyMS/ にはなりません。やりたい
>>> configParser('conffig.ini') # should not exist
Traceback (most recent call last):
...
IOError: No such file: os.path.abspath(conffig.ini)
しかし、docstring にあるため、結果の一部として os.path.abspath( が表示されます。
docstring テスト変数の結果を作成するにはどうすればよいですか?