TT#43813 django-pytest for testing instead of deprecated django-jenkins

* skip pylint check for now, lots of changes needed to pass

* tmux.sh support using a different tag for repoapi image
  this helps to download a tag from a review localy and
  hack

Change-Id: I63f034d9d4b73f7e6eb69b0cd3ad6f731281f806
changes/72/38672/7
Victor Seva 5 years ago
parent 2a448a089e
commit 52854d099a

@ -18,8 +18,12 @@ venv_dev: requirements/dev.txt
###################################
test:
RESULTS=$(RESULTS) ./manage.py jenkins --enable-coverage --noinput --output-dir $(RESULTS) \
--settings="repoapi.settings.test"
RESULTS=$(RESULTS) pytest-3 --junitxml=$(RESULTS)/junit.xml \
--cov=. --cov-report=xml:$(RESULTS)/coverage.xml --pep8
test_pylint:
RESULTS=$(RESULTS) pytest-3 --junitxml=$(RESULTS)/junit.xml \
--pylint --pylint-rcfile=pylint.cfg --pylint-jobs=4
###################################

@ -19,16 +19,6 @@ from os.path import dirname
BASE_DIR = dirname(dirname(dirname(os.path.abspath(__file__))))
# Application definition
# django-jenkins
PROJECT_APPS = [
"repoapi",
"hotfix",
"panel",
"release_dashboard",
"build",
]
INSTALLED_APPS = [
"object_tools",
"django.contrib.admin",
@ -46,6 +36,11 @@ INSTALLED_APPS = [
"django_filters",
"jsonify",
"export",
"repoapi",
"hotfix",
"panel",
"release_dashboard",
"build",
]
MIDDLEWARE_CLASSES = (

@ -44,8 +44,6 @@ DEBUG = False
ALLOWED_HOSTS = [".mgm.sipwise.com"]
INSTALLED_APPS.extend(PROJECT_APPS) # noqa
LOGGING["loggers"]["repoapi"]["level"] = os.getenv( # noqa
"DJANGO_LOG_LEVEL", "INFO"
) # noqa

@ -37,12 +37,6 @@ DEBUG = True
ALLOWED_HOSTS = []
TESTING_APPS = [
"django_jenkins",
]
INSTALLED_APPS.extend(TESTING_APPS) # noqa
INSTALLED_APPS.extend(PROJECT_APPS) # noqa
# Database
# https://docs.djangoproject.com/en/1.8/ref/settings/#databases
@ -53,13 +47,6 @@ DATABASES = {
}
}
# django-jenkins
JENKINS_TASKS = (
"django_jenkins.tasks.run_pylint",
"django_jenkins.tasks.run_flake8",
)
PYLINT_RCFILE = "pylint.cfg"
DJANGO_LOG_LEVEL = "DEBUG"
JENKINS_URL = "http://localhost"

@ -1,9 +1,2 @@
-r common.txt
# django-jenkins is not maintained right now
# this has some comunity fixes applied
-e git://github.com/linuxmaniac/django-jenkins.git#egg=django-jenkins
flake8
pep8
pylint
coverage
mock

@ -5,10 +5,18 @@ FROM docker.mgm.sipwise.com/sipwise-buster:latest
# is updated with the current date. It will force refresh of all
# of the base images and things like `apt-get update` won't be using
# old cached versions when the Dockerfile is built.
ENV REFRESHED_AT 2020-03-06
ENV REFRESHED_AT 2020-03-20
# test execution; we need the backport of python3-junitxml from our own
# repository since it's not part of Debian/buster
# files that get-code generates
COPY t/sources.list.d/builddeps.list /etc/apt/sources.list.d/
COPY t/sources.list.d/preferences /etc/apt/preferences.d/
RUN apt-get update
RUN apt-get install --assume-yes python3 python3-dev \
python3-pytest python3-pytest-django python3-pytest-pep8 \
python3-pytest-pylint python3-pytest-cov python3-junitxml \
python3-pip python3-virtualenv virtualenv sqlite3 git tmux
# Get pip to download and install requirements:

@ -1,7 +1,10 @@
#!/bin/bash
repoapi_tag=${1:-latest}
repoapi_image=docker.mgm.sipwise.com/repoapi-buster:${repoapi_tag}
docker run -d --rm \
--hostname repoapi-rabbit --name repoapi-rabbit rabbitmq:3
docker pull docker.mgm.sipwise.com/repoapi-buster:latest
docker pull "${repoapi_image}"
docker run --rm -i -t --env=VAR_DIR=/code --link repoapi-rabbit:rabbit \
-v "$(pwd)":/code:rw docker.mgm.sipwise.com/repoapi-buster:latest tmux
-v "$(pwd)":/code:rw "${repoapi_image}" tmux
docker stop repoapi-rabbit

@ -0,0 +1,7 @@
[pytest]
DJANGO_SETTINGS_MODULE = repoapi.settings.test
# -- recommended but optional:
python_files = tests.py test_*.py *_tests.py
[coverage:run]
data_file = ${RESULTS}/.coverage
Loading…
Cancel
Save