python - Using Mocks inside Doctests? -
i using doctests. wondering correct way doctest function performs external action (e.g. sends email, connects server, etc)? using mock seems answer muddy doc string of function.
for example:
class sshconnection(baseconnection): """provides basic ssh functions. >>> host = '127.0.0.1' >>> port = 22 >>> username = 'user' >>> password = 'password' >>> ssh = sshconnection(host, username, password, port) >>> ssh.execute('uname -a') """ ...
Comments
Post a Comment