add tests infrastructure
This commit is contained in:
parent
18e7a9c2b2
commit
9089715a59
|
@ -2,7 +2,20 @@
|
|||
|
||||
pipeline {
|
||||
agent any
|
||||
options {
|
||||
disableConcurrentBuilds()
|
||||
}
|
||||
stages {
|
||||
stage('Unit Tests') {
|
||||
steps {
|
||||
sh 'tox -rv'
|
||||
}
|
||||
post {
|
||||
always {
|
||||
mergeJunitResults()
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Packaging') {
|
||||
steps {
|
||||
script {
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
import os
|
||||
|
||||
|
||||
INSTALLED_APPS += ('combo_plugin_nanterre',)
|
||||
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.postgresql_psycopg2',
|
||||
'TEST': {
|
||||
'NAME': 'combo-plugin-nanterre-test-%s'
|
||||
% os.environ.get("BRANCH_NAME", "").replace('/', '-')[:40],
|
||||
},
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
import django_webtest
|
||||
import pytest
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def app(request, db):
|
||||
wtm = django_webtest.WebTestMixin()
|
||||
wtm._patch_settings()
|
||||
yield django_webtest.DjangoTestApp()
|
||||
wtm._unpatch_settings()
|
||||
|
||||
|
||||
def test_url(app):
|
||||
resp = app.get('/_plugin/nanterre/saga-retour-asynchrone/')
|
||||
assert resp.json == {'err': 1}
|
|
@ -0,0 +1,31 @@
|
|||
[tox]
|
||||
envlist = py3-black-pytest-coverage
|
||||
toxworkdir = {env:TMPDIR:/tmp}/tox-{env:USER}/combo-plugin-nanterre/{env:BRANCH_NAME:}
|
||||
|
||||
[testenv]
|
||||
usedevelop =
|
||||
coverage: True
|
||||
nocoverage: False
|
||||
setenv =
|
||||
DJANGO_SETTINGS_MODULE=combo.settings
|
||||
COMBO_SETTINGS_FILE=tests/settings.py
|
||||
DB_ENGINE=django.db.backends.postgresql_psycopg2
|
||||
SETUPTOOLS_USE_DISTUTILS=stdlib
|
||||
coverage: COVERAGE=--cov-report xml --cov-report html --cov=combo_plugin_nanterre/
|
||||
pytest: PYTEST=--junitxml=junit-{envname}.xml
|
||||
deps =
|
||||
pytest
|
||||
pytest-cov
|
||||
pytest-django
|
||||
WebTest
|
||||
django-webtest
|
||||
psycopg2-binary
|
||||
psycopg2
|
||||
django-ratelimit<3
|
||||
django>=2.2,<2.3
|
||||
git+https://git.entrouvert.org/debian/django-ckeditor.git
|
||||
git+https://git.entrouvert.org/combo.git
|
||||
black: pre-commit
|
||||
commands =
|
||||
pytest: py.test {posargs: {env:PYTEST:} {env:COVERAGE:} tests/}
|
||||
black: pre-commit run black --all-files --show-diff-on-failure
|
Loading…
Reference in New Issue