Test module: standard_logging.py

standard_logging.py

This module tests the logging.Logger instance returned by standard_logging.py with a variety of options and choices. These tests use the standard unittest package and extend the unittest.TestCase class.

module_version:1.0
created_on:2013-04-08

Standard Logging tests

class tests.standard_logging.TestStandardLogging(methodName='runTest')[source]

Test the functions defined in standard_logging.py.

A standard logging.Logger instance is created from a call to standard_logging and then is tested with different sets of arguments.

setUp()[source]

Initialize the framework for testing.

Creates a new system temporary directory with the tempfile package as a place to generate our test log file, and generate a name for the test log file. Also generates argparse.ArgumentParser instance from standard_parsers.py, a fake command line and arguments.

tearDown()[source]

Remove testing framework.

Deletes the created temporary directory and thisfileexists.txt file.

test_standard_logger_attributes()[source]

Test for graceful fail when not given required arguments

Test object Expectation
no verbose argument Raise AttributeError
no log argument Raise AttributeError
test_standard_logger_basic_logging()[source]

Test for open logfile & that script command-line is correctly written

Test object Expectation
valid command-line arguments Create file and write welcome message, time date and calling command line to it.
test_standard_logger_parsed_arguments()[source]

Test for logging of parsed arguments

Test object Expectation
valid command-line arguments Log the full set of script arguments parsed byt he parser. Include defaults and make sure they are marked.

Table Of Contents

Previous topic

Test module: custom_callables.py

This Page