Add support for "isolated" tests (#148)

This commit is contained in:
Christopher C. Wells 2020-07-26 20:02:51 -07:00
parent 7abe7b2a5f
commit 3005fe3976
2 changed files with 26 additions and 2 deletions

View File

@ -58,6 +58,11 @@ module.exports = {
'babybuddy.scss' 'babybuddy.scss'
] ]
}, },
testsConfig: {
isolated: [
'babybuddy.tests.tests_formats.FormatsTestCase.test_use_24_hour_time_format_en'
],
},
watchConfig: { watchConfig: {
scriptsGlob: [ scriptsGlob: [
'*/static_src/js/**/*.js', '*/static_src/js/**/*.js',

View File

@ -2,6 +2,7 @@ var gulp = require('gulp');
var concat = require('gulp-concat'); var concat = require('gulp-concat');
var del = require('del'); var del = require('del');
var es = require('child_process').execSync;
var flatten = require('gulp-flatten'); var flatten = require('gulp-flatten');
var pump = require('pump'); var pump = require('pump');
var sass = require('gulp-sass'); var sass = require('gulp-sass');
@ -47,7 +48,16 @@ function coverage(cb) {
{ {
stdio: 'inherit' stdio: 'inherit'
} }
).on('exit', cb); ).on('exit', function() {
// Add coverage for isolated tests.
config.testsConfig.isolated.forEach(function(test_name) {
es(
'pipenv run coverage run -a manage.py test ' + test_name,
{stdio: 'inherit'}
);
})
cb();
});
} }
/** /**
@ -176,7 +186,16 @@ function test(cb) {
'isolate' 'isolate'
]; ];
command = command.concat(process.argv.splice(3)); command = command.concat(process.argv.splice(3));
spawn('pipenv', command, { stdio: 'inherit' }).on('exit', cb); spawn('pipenv', command, { stdio: 'inherit' }).on('exit', function() {
// Run isolated tests.
config.testsConfig.isolated.forEach(function(test_name) {
es(
'pipenv run python manage.py test ' + test_name,
{stdio: 'inherit'}
);
})
cb();
});
} }
/** /**