def run_doctest(target_dir=None, *args, **kwargs):
 import doctest
 default_kwargs = {'optionflags': doctest.ELLIPSIS}
 kwargs.update(default_kwargs)
 cur_dir = os.path.abspath(os.curdir)
 print('Running doctests...')
 try:
  os.chdir(find_test_dir(target_dir))
  doctest.testmod(*args, **kwargs)
 finally:
  os.chdir(cur_dir)
 print('Done')

def run_doctest ( target_dir = None , * args , ** kwargs ) : import doctest default_kwargs = { 'optionflags' : doctest . ELLIPSIS } kwargs . update ( default_kwargs ) cur_dir = os . path . abspath ( os . curdir ) print ( 'Running doctests...' ) try : os . chdir ( find_test_dir ( target_dir ) ) doctest . testmod ( * args , ** kwargs ) finally : os . chdir ( cur_dir ) print ( 'Done' )
run doctest on the given module .