included coverage.py
Sonarqube Scanner / Build and analyze (push) Failing after 27s

This commit is contained in:
Florian Zumpe
2026-06-17 15:28:15 +02:00
parent 95026aac6e
commit 0b5c994957
6 changed files with 163 additions and 7 deletions
+12 -2
View File
@@ -25,6 +25,7 @@ test('upload MIME types are detected from content and not trusted request metada
test('Python API tools are syntax-valid and contain reusable 401 authentication handling', async () => {
const toolsDir = path.join(root, 'tools/python');
const coverageRunnerPath = path.join(root, 'test-support/python_coverage_runner.py');
const names = (await fs.readdir(toolsDir)).filter(name => name.endsWith('.py'));
const expected = [
'append_route.py', 'common.py', 'create_audio.py', 'create_picture.py', 'create_poi.py',
@@ -36,15 +37,21 @@ test('Python API tools are syntax-valid and contain reusable 401 authentication
expected.toSorted((left, right) => left.localeCompare(right))
);
const compile = spawnSync('python3', ['-m', 'py_compile', ...names.map(name => path.join(toolsDir, name))], {
const compile = spawnSync('python3', [
'-m', 'py_compile',
...names.map(name => path.join(toolsDir, name)),
coverageRunnerPath
], {
cwd: root,
encoding: 'utf8'
});
assert.equal(compile.status, 0, compile.stderr);
await fs.rm(path.join(toolsDir, '__pycache__'), { recursive: true, force: true });
await fs.rm(path.join(root, 'test-support/__pycache__'), { recursive: true, force: true });
const common = await read('tools/python/common.py');
const sonar = await read('sonar-project.properties');
const coverageRunner = await read('test-support/python_coverage_runner.py');
const requirements = await read('requirements-dev.txt');
const pkg = JSON.parse(await read('package.json'));
assert.match(common, /class ApiClient/);
@@ -58,7 +65,10 @@ test('Python API tools are syntax-valid and contain reusable 401 authentication
assert.match(common, /traceback\.print_exception/);
assert.doesNotMatch(common, /Content-Type:.*application\/octet-stream/);
assert.match(pkg.scripts['test:coverage'], /test:coverage:python/);
assert.match(pkg.scripts['test:coverage:python'], /coverage\/python\/coverage\.xml/);
assert.match(pkg.scripts['test:coverage:python'], /python_coverage_runner\.py/);
assert.match(coverageRunner, /coverage\/python\/coverage\.xml/);
assert.match(coverageRunner, /--target/);
assert.match(coverageRunner, /traceback\.print_exc/);
assert.match(sonar, /sonar\.python\.coverage\.reportPaths=coverage\/python\/coverage\.xml/);
assert.match(requirements, /^coverage==/m);
});