Skip to content
This repository has been archived by the owner on Sep 22, 2019. It is now read-only.

WIP: use tox to run tests #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ coverage.xml
# Sphinx documentation
docs/_build/

# mkdocs
site/

# PyBuilder
target/

Expand Down
7 changes: 1 addition & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
language: python
python:
- '3.4'
- '3.6'
- '3.5'
- '3.4'
env:
- DJANGO_VERSION=1.11
- DJANGO_VERSION=1.10
- DJANGO_VERSION=1.9
- DJANGO_VERSION=1.8
services:
- mysql
- postgresql
Expand Down
10 changes: 5 additions & 5 deletions django_prometheus/tests/end2end/testapp/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,18 +109,18 @@ def GetMiddlewareClasses():
'NAME': 'postgres',
'USER': 'postgres',
'PASSWORD': '',
'HOST': 'localhost',
'PORT': '5432',
'HOST': os.getenv('PG_HOST', 'localhost'),
'PORT': os.getenv('PG_PORT', '5432'),
},

# Comment this to not test django_prometheus.db.backends.mysql.
'mysql': {
'ENGINE': 'django_prometheus.db.backends.mysql',
'NAME': 'django_prometheus_1',
'USER': 'travis',
'USER': os.getenv('MYSQL_USER', 'travis'),
'PASSWORD': '',
'HOST': 'localhost',
'PORT': '3306',
'HOST': os.getenv('MYSQL_HOST', 'localhost'),
'PORT': os.getenv('MYSQL_PORT', '3306'),
},

# The following databases are used by test_db.py only
Expand Down
7 changes: 7 additions & 0 deletions django_prometheus/tests/end2end/toxrun.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# -*- coding: utf-8 -*-
import os
import subprocess
import sys

os.chdir('django_prometheus/tests/end2end')
sys.exit(subprocess.call('python manage.py test', shell=True))
17 changes: 17 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
version: "2"

services:
postgres:
image: "postgres:9.6"
ports:
- "5432:5432"
mysql:
image: "mysql:5.7"
ports:
- "3306:3306"
environment:
- MYSQL_DATABASE=django_prometheus_1
- MYSQL_USER=travis
- MYSQL_ALLOW_EMPTY_PASSWORD=yes
- MYSQL_PASSWORD=
- MYSQL_ROOT_PASSWORD=
File renamed without changes.
17 changes: 17 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Welcome to MkDocs

For full documentation visit [mkdocs.org](http://mkdocs.org).

## Commands

* `mkdocs new [dir-name]` - Create a new project.
* `mkdocs serve` - Start the live-reloading docs server.
* `mkdocs build` - Build the documentation site.
* `mkdocs help` - Print this help message.

## Project layout

mkdocs.yml # The configuration file.
docs/
index.md # The documentation homepage.
... # Other markdown pages, images and other files.
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
site_name: My Docs
4 changes: 0 additions & 4 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
Django>=1.4
flake8
isort
prometheus-client>=0.0.15
pip-prometheus>=1.0.0
mock>=1.0.1
mysqlclient
Expand Down
68 changes: 68 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# [pytest]
# python_paths = ./tests
# changedir = ./tests
# DJANGO_SETTINGS_MODULE = django_prom_storage_tests.settings
# addopts=--tb=short
# python_files = tests.py test_*.py *_tests.py

[tox]
envlist =
{py34,py35}-django{18,19,110,111}-prom0015,
py36-django111-prom{,0015},
lint,
isort,
docs,
skip_missing_interpreters=True

[travis]
python =
3.4: py34
3.5: py35, lint, isort, docs
3.6: py36

[travis:env]
DJANGO =
1.8: django18
1.9: django19
1.10: django110
1.11: django111, lint, isort, docs

[testenv]
commands =
python setup.py test
python django_prometheus/tests/end2end/toxrun.py
setenv =
PYTHONDONTWRITEBYTECODE=1
MYSQL_HOST={env:MYSQL_HOST:127.0.0.1}
MYSQL_USER={env:MYSQL_USER:root}

deps =
django18: Django>=1.8,<1.9
django19: Django>=1.9,<1.10
django110: Django>=1.10,<1.11
django111: Django>=1.11,<2.0
prom: prometheus-client
prom0015: prometheus-client==0.0.15
-rrequirements.txt

[testenv:isort]
setenv=
PYTHONWARNINGS=ignore
basepython = python3.5
deps =
isort==4.2.13
-rrequirements.txt
commands = isort -df -rc -c

[testenv:lint]
setenv=
PYTHONWARNINGS=ignore
basepython = python3.5
deps = flake8==3.3.0
commands = flake8 --config .flake8rc

[testenv:docs]
basepython = python3.5
deps = mkdocs
commands = mkdocs build