From 314a32eed664163a94399af283ad97a527fd22cc Mon Sep 17 00:00:00 2001 From: Luke Murphy Date: Sun, 8 Apr 2018 22:22:31 +0200 Subject: [PATCH] Get a basic pytest CI in there. --- .gitignore | 3 +++ .gitlab-ci.yml | 31 +++++++++++++++++++++++++++++++ README.md | 10 ++++++++++ setup.cfg | 4 ++++ system-requirements.txt | 3 +++ test_requirements.txt | 3 +++ 6 files changed, 54 insertions(+) create mode 100644 .gitlab-ci.yml create mode 100644 setup.cfg create mode 100644 system-requirements.txt create mode 100644 test_requirements.txt diff --git a/.gitignore b/.gitignore index ea654f1..eb2aafb 100644 --- a/.gitignore +++ b/.gitignore @@ -108,3 +108,6 @@ environment # Docker stuff .containers + +# Pytest +.pytest_cache diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..7e34ce9 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,31 @@ +--- + +image: python:3.5 + +stages: + - test + +services: + - mdillon/postgis:9.6-alpine + +variables: + DEBUG: 1 + + POSTGRES_DB: ojusomap + POSTGRES_USER: ojusomap + POSTGRES_PASSWORD: passw0rd + + DATABASE_HOST: mdillon__postgis + DATABASE_NAME: $POSTGRES_DB + DATABASE_USER: $POSTGRES_USER + DATABASE_PASSWORD: $POSTGRES_PASSWORD + + +pytest: + stage: test + before_script: + - pip install -U pip setuptools + - pip install -r test_requirements.txt + - apt-get update && cat system-requirements.txt | xargs apt-get install -y + script: + - pytest -v diff --git a/README.md b/README.md index 6ae9996..2fee17d 100644 --- a/README.md +++ b/README.md @@ -2,3 +2,13 @@ [![Translation](http://translate.ojuso.org/widgets/platform/-/svg-badge.svg)](http://translate.ojuso.org/engage/platform/?utm_source=widget) Kickass map for the Ojuso Project + +# Run The Tests + +```bash +$ cat system-requirements.txt | sudo apt-get install -y +$ pip install -r test_requirements.txt +$ pytest +``` + +Please note, the system dependencies have only been tested on Debian Stretch. diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..cae3ea2 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,4 @@ +[tool:pytest] +DJANGO_SETTINGS_MODULE = ojusomap.settings +python_files = tests.py test_*.py *_tests.py +addopts = --reuse-db --strict --tb=short diff --git a/system-requirements.txt b/system-requirements.txt new file mode 100644 index 0000000..539ef5c --- /dev/null +++ b/system-requirements.txt @@ -0,0 +1,3 @@ +libgdal-dev +python3-gdal +gdal-bin diff --git a/test_requirements.txt b/test_requirements.txt new file mode 100644 index 0000000..f69af36 --- /dev/null +++ b/test_requirements.txt @@ -0,0 +1,3 @@ +-r requirements.txt +pytest==3.5.0 +pytest-django==3.1.2