Package utils :: Module code_coverage :: Class code_coverage
[show private | hide private]
[frames | no frames]

Class code_coverage


The purpose of this class is to provide an easy interface to keeping track of code coverage data. The Process Stalker utility for example relies on this class.

Note: Contains hit list in self.hits.

Method Summary
  __init__(self, mysql, heavy)
code_coverage add(self, pydbg, is_function)
Add the current context to the tracked code coverage.
code_coverage clear_mysql(self, target_id, tag_id)
Removes all code coverage hits from target/tag id combination.
code_coverage connect_mysql(self, host, user, passwd)
Establish a connection to a MySQL server.
code_coverage export_file(file_name)
Dump the entire object structure to disk.
code_coverage export_mysql(self, target_id, tag_id)
Export code coverage data to MySQL.
code_coverage import_file(file_name)
Load the entire object structure from disk.
code_coverage import_mysql(self, target_id, tag_id)
Import code coverage from MySQL.
code_coverage reset(self)
Reset the internal counter and hit list dictionary.

Class Variable Summary
NoneType heavy = None                                                                  
dict hits = {}
str main_module = '[MAIN]'
NoneType mysql = None                                                                  
int num = 1                                                                     

Method Details

__init__(self, mysql=None, heavy=False)
(Constructor)

Parameters:
heavy - (Optional, Def=False) Flag controlling whether or not to save context information at each point.
           (type=Boolean)

add(self, pydbg, is_function)

Add the current context to the tracked code coverage.
Parameters:
pydbg - Debugger instance
           (type=PyDbg)
is_function - Flag whether or not the current hit occurred at the start of a function.
           (type=Integer (bool 0/1))
Returns:
self
           (type=code_coverage)

clear_mysql(self, target_id, tag_id)

Removes all code coverage hits from target/tag id combination. Expects connection to database to already exist via self.mysql.
Parameters:
target_id - Name of target currently monitoring code coverage of
           (type=Integer)
tag_id - Name of this code coverage run
           (type=Integer)
Returns:
self
           (type=code_coverage)

See Also: connect_mysql(), import_mysql(), export_mysql()

connect_mysql(self, host, user, passwd)

Establish a connection to a MySQL server. This must be called prior to export_mysql() or import_mysql(). Alternatively, you can connect manually and set the self.mysql member variable.
Parameters:
host - MySQL hostname or ip address
           (type=String)
user - MySQL username
           (type=String)
passwd - MySQL password
           (type=String)
Returns:
self
           (type=code_coverage)

See Also: export_mysql(), import_mysql()

export_file(file_name)

Dump the entire object structure to disk.
Returns:
self
           (type=code_coverage)

See Also: import_file()

export_mysql(self, target_id, tag_id)

Export code coverage data to MySQL. Expects connection to database to already exist via self.mysql.
Parameters:
target_id - Name of target currently monitoring code coverage of
           (type=Integer)
tag_id - Name of this code coverage run
           (type=Integer)
Returns:
self
           (type=code_coverage)

See Also: clear_mysql(), connect_mysql(), import_mysql()

import_file(file_name)

Load the entire object structure from disk.
Returns:
self
           (type=code_coverage)

See Also: export_file()

import_mysql(self, target_id, tag_id)

Import code coverage from MySQL. Expects connection to database to already exist via self.mysql.
Parameters:
target_id - Name of target currently monitoring code coverage of
           (type=Integer)
tag_id - Name of this code coverage run
           (type=Integer)
Returns:
self
           (type=code_coverage)

See Also: clear_mysql(), connect_mysql(), export_mysql()

reset(self)

Reset the internal counter and hit list dictionary.
Returns:
self
           (type=code_coverage)

Class Variable Details

heavy

Type:
NoneType
Value:
None                                                                  

hits

Type:
dict
Value:
{}                                                                     

main_module

Type:
str
Value:
'[MAIN]'                                                               

mysql

Type:
NoneType
Value:
None                                                                  

num

Type:
int
Value:
1                                                                     

Generated by Epydoc 2.1 on Fri Jun 16 17:16:26 2006 http://epydoc.sf.net