Commit 46bda566 authored by Jérome Perrin's avatar Jérome Perrin Committed by Kazuhiko Shiozaki

tests: remove broken coverage support

coverage needs to be started before importing the modules, so it can
not be started so late in runUnitTest, it has to be started before
importing any Products/ERP5* code, ie. in slapos wrapper script.

See https://coverage.readthedocs.io/en/6.5.0/faq.html#q-why-do-the-bodies-of-functions-show-as-executed-but-the-def-lines-do-not
for more details about the rationale
parent 127975bc
......@@ -12,10 +12,7 @@ import errno
import random
import transaction
from glob import glob
try:
from coverage import coverage
except ImportError:
coverage = None
WIN = os.name == 'nt'
......@@ -27,8 +24,6 @@ Options:
-v, --verbose produce verbose output
-h, --help this help screen
-p, --profile print profiling results at the end
--coverage=STRING Use the given path as a coverage config file and
thus enable code coverateg report
--portal_id=STRING force id of the portal. Useful when using
--data_fs_path to run tests on an existing
Data.fs
......@@ -638,11 +633,6 @@ def runUnitTestList(test_list, verbosity=1, debug=0, run_only=None):
signal.signal(signal.SIGINT, shutdown)
signal.signal(signal.SIGHUP, shutdown)
coverage_config = os.environ.get('coverage', None)
if coverage_config:
coverage_process = coverage(config_file=coverage_config)
coverage_process.start()
try:
save = int(os.environ.get('erp5_save_data_fs', 0))
load = int(os.environ.get('erp5_load_data_fs', 0))
......@@ -717,11 +707,6 @@ def runUnitTestList(test_list, verbosity=1, debug=0, run_only=None):
# disconnected from it.
wcfs_server.stop()
if coverage_config:
coverage_process.stop()
coverage_process.save()
coverage_process.html_report()
if save and save_mysql:
save_mysql(verbosity)
......@@ -747,7 +732,7 @@ def main(argument_list=None):
sys.argv.extend(old_argv[1:])
try:
opts, args = getopt.getopt(sys.argv[1:],
"hpvD", ["help", "verbose", "profile", "coverage=", "portal_id=",
"hpvD", ["help", "verbose", "profile", "portal_id=",
"data_fs_path=",
"bt5_path=",
"firefox_bin=",
......@@ -810,11 +795,6 @@ def main(argument_list=None):
elif opt == '-D':
debug = 1
os.environ["erp5_debug_mode"] = str(debug)
elif opt == "--coverage":
if coverage:
os.environ['coverage'] = arg
else:
_print("WARNING Coverage module not found")
elif opt in ("-p", "--profile"):
os.environ['PROFILE_TESTS'] = "1"
# profiling of setup and teardown is disabled by default, just set
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment