Finalized integration of coverage.py within the Appy framework.
This commit is contained in:
parent
01487db688
commit
c3f5cfc9cd
5 changed files with 66 additions and 32 deletions
|
@ -1,4 +1,30 @@
|
|||
<!codeHeader!>
|
||||
# Test coverage-related stuff --------------------------------------------------
|
||||
import sys
|
||||
from appy.gen.plone25.mixins.TestMixin import TestMixin
|
||||
covFolder = TestMixin.getCovFolder()
|
||||
# The previous method checks in sys.argv whether Zope was lauched for performing
|
||||
# coverage tests or not.
|
||||
cov = None # The main Coverage instance as created by the coverage program.
|
||||
totalNumberOfTests = <!totalNumberOfTests!>
|
||||
numberOfExecutedTests = 0
|
||||
if covFolder:
|
||||
try:
|
||||
import coverage
|
||||
from coverage import coverage
|
||||
cov = coverage()
|
||||
cov.start()
|
||||
except ImportError:
|
||||
print 'COVERAGE KO! The "coverage" program is not installed. You can ' \
|
||||
'download it from http://nedbatchelder.com/code/coverage.' \
|
||||
'\nHit <enter> to execute the test suite without coverage.'
|
||||
sys.stdin.readline()
|
||||
|
||||
def countTest():
|
||||
global numberOfExecutedTests
|
||||
numberOfExecutedTests += 1
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
from config import *
|
||||
import logging
|
||||
try:
|
||||
|
@ -13,6 +39,7 @@ from Products.Archetypes import listTypes
|
|||
from appy.gen.plone25.installer import ZopeInstaller
|
||||
logger = logging.getLogger(PROJECTNAME)
|
||||
|
||||
# Zope-level installation of the generated product. ----------------------------
|
||||
def initialize(context):
|
||||
<!imports!>
|
||||
# I need to do those imports here; else, types and add permissions will not
|
||||
|
@ -21,3 +48,4 @@ def initialize(context):
|
|||
<!applicationName!>Tool.<!applicationName!>Tool,
|
||||
DEFAULT_ADD_CONTENT_PERMISSION, ADD_CONTENT_PERMISSIONS,
|
||||
logger, globals()).install()
|
||||
# ------------------------------------------------------------------------------
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue