blob: 2e7bbfbbbf407eaa2f3313fb54cbae2d37644bd7 [file] [log] [blame]
---
# python module unit test
- job-template:
id: 'python-unit-test'
name: 'verify_{project}_unit-test'
description: |
Created by {id} job-template from ci-management/jjb/xos-unit.yaml
triggers:
- cord-infra-gerrit-trigger-patchset:
gerrit-server-name: '{gerrit-server-name}'
project-regexp: '^{project}$'
branch-regexp: '{branch-regexp}'
dependency-jobs: '{dependency-jobs}'
file-include-regexp: '{all-files-regexp}'
properties:
- cord-infra-properties:
build-days-to-keep: '{build-days-to-keep}'
artifact-num-to-keep: '{artifact-num-to-keep}'
wrappers:
- lf-infra-wrappers:
build-timeout: 20
jenkins-ssh-credential: '{jenkins-ssh-credential}'
scm:
- lf-infra-gerrit-scm:
git-url: '$GIT_URL/$GERRIT_PROJECT'
refspec: '$GERRIT_REFSPEC'
branch: '$GERRIT_BRANCH'
submodule-recursive: 'false'
choosing-strategy: gerrit
jenkins-ssh-credential: '{jenkins-ssh-credential}'
node: '{build-node}'
project-type: freestyle
concurrent: true
builders:
- shell: |
#!/usr/bin/env bash
set -eux -o pipefail
if [ -f 'Makefile' ]; then
echo "Makefile found, running 'make test'"
make test
elif [ -f 'tox.ini' ]; then
echo "tox.ini found, running tox for Python2/3 unit tests"
tox
else
echo "Makefile or tox.ini not found, running nose2 unit tests"
if [ -f 'requirements.txt' ]; then
echo "requirements.txt found, installing locally with pip"
pip install -r requirements.txt
fi
echo "Performing nose2 tests"
nose2 --verbose --coverage-report xml --coverage-report term --junit-xml
fi
publishers:
- junit:
results: "**/*junit.xml,**/*results.xml,**/*report.xml"
- cobertura:
report-file: "**/*coverage.xml"
targets:
- files:
healthy: 80
unhealthy: 0
failing: 0
- method:
healthy: 50
unhealthy: 0
failing: 0