[Pydev-cvs] org.python.pydev.debug/pysrc coverage.py,1.4,1.5
Brought to you by:
fabioz
From: Fabio Z. <fa...@us...> - 2004-10-19 11:12:29
|
Update of /cvsroot/pydev/org.python.pydev.debug/pysrc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28341/pysrc Modified Files: coverage.py Log Message: Index: coverage.py =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/pysrc/coverage.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** coverage.py 18 Oct 2004 19:13:13 -0000 1.4 --- coverage.py 19 Oct 2004 11:12:17 -0000 1.5 *************** *** 88,92 **** return t ! the_coverage = None class coverage: --- 88,95 ---- return t ! ! def getCoverageLoc(self): ! global cache_location ! return cache_location class coverage: *************** *** 112,120 **** canonical_filename_cache = {} def __init__(self): global the_coverage ! if the_coverage: ! raise self.error, "Only one coverage object allowed." ! self.cache = os.environ.get(self.cache_env, self.cache_default) self.restore() self.analysis_cache = {} --- 115,127 ---- canonical_filename_cache = {} + def __init__(self): global the_coverage ! try: ! if the_coverage: ! raise self.error, "Only one coverage object allowed." ! except NameError:#that's ok, it is still not defined... ! pass ! self.cache = getCoverageLoc(self) self.restore() self.analysis_cache = {} *************** *** 517,522 **** - # Singleton object. - the_coverage = coverage() # Module functions call methods in the singleton object. --- 524,527 ---- *************** *** 527,538 **** def report(*args): return apply(the_coverage.report, args) - # Save coverage data when Python exits. (The atexit module wasn't - # introduced until Python 2.0, so use sys.exitfunc when it's not - # available.) - try: - import atexit - atexit.register(the_coverage.save) - except ImportError: - sys.exitfunc = the_coverage.save # Command-line interface. --- 532,535 ---- *************** *** 541,549 **** --- 538,568 ---- # goes to a raw_input() and waits for the files that should be executed... + + global cache_location #let's set the cache location now... + cache_location = sys.argv[1] #first parameter is the cache location. + sys.argv.remove(cache_location) + print cache_location + + global the_coverage + # Singleton object. + the_coverage = coverage() + + # Save coverage data when Python exits. (The atexit module wasn't + # introduced until Python 2.0, so use sys.exitfunc when it's not + # available.) + try: + import atexit + atexit.register(the_coverage.save) + except ImportError: + sys.exitfunc = the_coverage.save + if len(sys.argv) == 2: + if '-waitfor' == sys.argv[1]: sys.argv.remove('-waitfor') sys.argv.append('-r') sys.argv.append('-m') + + #second gets the files to be executed s = raw_input() s = s.replace('\r', '') |