# Asterisk Project : Python Modules

Added by mjordan , edited by mjordan on Jun 23, 2012

There are a number of libraries that have been developed to ease common tasks that many tests require. Of particular note is the TestCase class, which acts as a common base class for the Python tests. While you do not have to inherit from this class to have a working test, you are encouraged to use it as it provides a common model and a large amount of functionality for the Python tests.

Library | Purpose
--- | ---
ami | A small wrapper class around starpy's AMI manager
asterisk | A class that manages an instance of Asterisk, including the location of its configuration files and interacting with it over the CLI
buildoptions | Determines the build options for the repository of Asterisk that contains the Test Suite, and whether or not a given test can execute given the build options
cdr | A set of classes that verify CSV CDRs
CDRTestCase | A class that inherits from TestCase, used by tests that verify CDRs
ChannelTestCondition | A pre/post condition module. Verifies that channels are not orphaned after test execution
confbridge | Provides a class that inherits from TestCase and other helper classes for tests that verify ConfBridge
config | Parses and represents an Asterisk configuration file in memory
FdTestCondition | A pre/post condition module. Verifies that file descriptors are not leaked after test execution
LockTestCondition | A pre/post condition module. Verifies that a deadlock has not occurred, or that locks are not held, after test execution
SipDialogTestCondition | A pre/post condition module. Verifies that after test execution, all SIP dialogs are in an expected state
sipp | Wrapper classes around SIPp scenarios
sippversion | Determines the version of SIPp on the system, and how it was compiled
syncami | A module that provides a wrapper to the HTTP version of AMI. starpy (and the ami module) use TCP for communication with Asterisk
TestCase | A base class for tests within the Test Suite. Provides a common framework for starting a test, stopping a test, and interacting with various components within the Test Suite
TestConditions | Manages the pre/post condition checking. This is an option for any test, but will greatly increase test execution times, and is not enabled on most test runs
TestConfig | Sets of classes that determine the configuration of a test from its corresponding test-config.yaml file
TestRunner | A module that executes tests directly from their configuration. Based on that configuration, additional modules can be loaded and plugged into the test object
TestState | A module that provides a controller and state machine for TestEvents from Asterisk. This is used for complex tests that require information from long running applications in Asterisk, such as app_voicemail or app_confbridge
ThreadTestCondition | A pre/post condition module. Verifies that all threads are cleaned up after test execution
utils | Various independent utilities that are too small to warrant their own module
version | Determines the installed version of Asterisk, and performs comparisons between Asterisk versions
voicemail | Provides a class that inherits from TestCase and other helper classes for tests that verify VoiceMail applications