3 Ned Batchelder |
3 Ned Batchelder |
4 http://nedbatchelder.com/code/coverage |
4 http://nedbatchelder.com/code/coverage |
5 |
5 |
6 """ |
6 """ |
7 |
7 |
8 __version__ = "3.0.1" # see detailed history in CHANGES.txt |
8 __version__ = "3.2" # see detailed history in CHANGES.txt |
9 |
9 |
10 from control import coverage |
10 __url__ = "http://nedbatchelder.com/code/coverage" |
11 from data import CoverageData |
11 |
12 from cmdline import main, CoverageScript |
12 from coverage.control import coverage |
13 from misc import CoverageException |
13 from coverage.data import CoverageData |
|
14 from coverage.cmdline import main, CoverageScript |
|
15 from coverage.misc import CoverageException |
14 |
16 |
15 |
17 |
16 # Module-level functions. The original API to this module was based on |
18 # Module-level functions. The original API to this module was based on |
17 # functions defined directly in the module, with a singleton of the coverage() |
19 # functions defined directly in the module, with a singleton of the coverage() |
18 # class. That design hampered programmability. Here we define the top-level |
20 # class. That design hampered programmability. Here we define the top-level |
22 # created as needed when one of the module-level functions is called. |
24 # created as needed when one of the module-level functions is called. |
23 _the_coverage = None |
25 _the_coverage = None |
24 |
26 |
25 def _singleton_method(name): |
27 def _singleton_method(name): |
26 """Return a function to the `name` method on a singleton `coverage` object. |
28 """Return a function to the `name` method on a singleton `coverage` object. |
27 |
29 |
28 The singleton object is created the first time one of these functions is |
30 The singleton object is created the first time one of these functions is |
29 called. |
31 called. |
30 |
32 |
31 """ |
33 """ |
32 def wrapper(*args, **kwargs): |
34 def wrapper(*args, **kwargs): |
33 """Singleton wrapper around a coverage method.""" |
35 """Singleton wrapper around a coverage method.""" |
34 global _the_coverage |
36 global _the_coverage |
35 if not _the_coverage: |
37 if not _the_coverage: |