Python 3 Logging Script to Write Logs Info to Output File Using sys Module Full Project For Beginners

 

 

import sys

def main(out = sys.stderr, verbosity = 2):
    loader = unittest.TestLoader()

    suite = loader.loadTestsFromModule(sys.modules[__name__])
    unittest.TextTestRunner(out, verbosity = verbosity).run(suite)
    
if __name__ == '__main__':
    with open('testing.out', 'w') as f:
        main(f)

Leave a Reply