mirror of
https://github.com/odoo/runbot.git
synced 2025-03-15 15:35:46 +07:00
[ADD] mergebot: support for coverage during tests
Runs the test instances of Odoo using `coverage` in parallel mode. - useful for finding out under-tested parts of the code - because it only instruments mergeport/forwardport, and the tests do so much IO, the wallclock performance impacts are minimal (~2% increase with branch coverage analysis, for an increase in CPU of ~20%, for the entire testsuite) - for reporting, the scattered coverage reports need to be aggregated using `coverage combine`, followed by rendering with `coverage html`, these work out of the box, no parameterization is necessary - coverage does not run on the test suite, only the modules under test
This commit is contained in:
parent
13f239826e
commit
1449937e00
@ -76,6 +76,7 @@ def pytest_addoption(parser):
|
||||
parser.addoption('--addons-path')
|
||||
parser.addoption("--no-delete", action="store_true", help="Don't delete repo after a failed run")
|
||||
parser.addoption('--log-github', action='store_true')
|
||||
parser.addoption('--coverage', action='store_true')
|
||||
|
||||
parser.addoption(
|
||||
'--tunnel', action="store", type="choice", choices=['', 'ngrok', 'localtunnel'], default='',
|
||||
@ -372,7 +373,13 @@ def server(request, db, port, module, dummy_addons_path, tmpdir):
|
||||
request.config.getoption('--addons-path'),
|
||||
dummy_addons_path,
|
||||
]))
|
||||
|
||||
cov = []
|
||||
if request.config.getoption('--coverage'):
|
||||
cov = ['coverage', 'run', '-p', '--source=odoo.addons.runbot_merge,odoo.addons.forwardport', '--branch']
|
||||
|
||||
p = subprocess.Popen([
|
||||
*cov,
|
||||
'odoo', '--http-port', str(port),
|
||||
'--addons-path', addons_path,
|
||||
'-d', db,
|
||||
|
Loading…
Reference in New Issue
Block a user