mercredi 28 septembre 2016

How to output verbose doctest to file within a program

I am trying to write a python program where at the end of the program, after the if __name__ == "__main__": dunder the program outputs the result of executing the file with the -v flag set. So far I have this:

if __name__ == "__main__":
import doctest
import subprocess
import os
doctest.testmod()
with open("is_float_documentation.txt", "w") as doc:
    subprocess.call(["cd", "'" +
                     os.path.dirname(os.path.realpath(__file__)) + "'"])
    subprocess.call(["python", ".\isfloat.py", "-v"])

but, this does not work perhaps due to some strange permissions errors that I am experiencing.

Aucun commentaire:

Enregistrer un commentaire