Support parallel tests in coverage

This commit is contained in:
Christopher C. Wells 2020-08-16 14:03:50 -07:00
parent f60c7884fe
commit 0fd8f1a3a7
2 changed files with 14 additions and 2 deletions

View File

@ -10,6 +10,9 @@ source =
core
dashboard
reports
parallel = true
concurrency = multiprocessing
data_file = data/.coverage
[html]
directory = htmlcov

View File

@ -34,6 +34,10 @@ function clean() {
* @param cb
*/
function coverage(cb) {
// Erase any previous coverage results.
es('pipenv run coverage erase', {stdio: 'inherit'});
// Run tests with coverage.
spawn(
'pipenv',
[
@ -50,13 +54,18 @@ function coverage(cb) {
stdio: 'inherit'
}
).on('exit', function() {
// Add coverage for isolated tests.
// Run isolated tests with coverage.
config.testsConfig.isolated.forEach(function(test_name) {
es(
'pipenv run coverage run -a manage.py test ' + test_name,
'pipenv run coverage run manage.py test ' + test_name,
{stdio: 'inherit'}
);
})
// Combine coverage results.
es('pipenv run coverage combine', {stdio: 'inherit'});
// Execute callback.
cb();
});
}