forked from OSQA/osqa
-
Notifications
You must be signed in to change notification settings - Fork 627
/
tox.ini
94 lines (87 loc) · 3.16 KB
/
tox.ini
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
[tox]
# to be portable, all environment names must start with py<number>-. This will
# make tox chose a specific python version. If we omit the py<number> factor,
# the result depends on the current state of the OS people are using.
# If available, tox runs tests for Python 3.6, 3.7, 3.8 and pypy3. It will skip
# any unavailable, i.e. not installed, version.
envlist =
py{36,37,38,py3}
py3-{setup,lint,coverage}
skip_missing_interpreters=true
requires = setuptools > 42.0.0
## One can use blocks as the two examples below, to provide tox with paths to
## different Python installations.
#
#[testenv:py36]
#basepython={env:HOME}/.local/python/3.6.10/bin/python3.6
#
#[testenv:py38]
#basepython={env:HOME}/.local/python/3.8.1/bin/python3.8
#
[envvars]
setenv =
JOBS={env:JOBS:8}
DB_TYPE={env:DB_TYPE:postgres}
DB_USER={env:DB_USER:askbot}
DB_PASS={env:DB_PASS:askB0T!}
DB_HOST={env:DB_HOST:localhost}
DB_PORT={env:DB_PORT:5432}
DB_NAME={env:DB_NAME:askbotfortox}
DATABASE_URL = {env:DATABASE_URL:{env:DB_TYPE}://{env:DB_USER}:{env:DB_PASS}@{env:DB_HOST}:{env:DB_PORT}/{env:DB_NAME}}
TOX_ENVSITEPACKAGESDIR = {envsitepackagesdir}
[unittests]
commands =
coverage run --rcfile ../.coveragerc manage.py test --parallel {env:JOBS} askbot.tests askbot.deps.django_authopenid.tests
[coverage]
commands =
coverage html --rcfile ../.coveragerc
[lint]
commands =
pylint -j {env:JOBS} --exit-zero --rcfile={toxinidir}/.pylintrc {toxinidir}/{posargs:askbot}
[setup]
whitelist_externals =
mkdir
rm
psql
commands_pre =
mkdir -p {toxinidir}/deploy_askbot
psql -h {env:DB_HOST} -p {env:DB_PORT} -U postgres -c "DROP DATABASE IF EXISTS {env:DB_NAME}"
-psql -h {env:DB_HOST} -p {env:DB_PORT} -U postgres -c "DROP ROLE IF EXISTS {env:DB_USER}"
-psql -h {env:DB_HOST} -p {env:DB_PORT} -U postgres -c "CREATE USER {env:DB_USER} WITH PASSWORD '{env:DB_PASS}'"
psql -h {env:DB_HOST} -p {env:DB_PORT} -U postgres -c "ALTER ROLE {env:DB_USER} SET client_encoding TO 'utf8'"
psql -h {env:DB_HOST} -p {env:DB_PORT} -U postgres -c "ALTER ROLE {env:DB_USER} SET default_transaction_isolation TO 'read committed'"
psql -h {env:DB_HOST} -p {env:DB_PORT} -U postgres -c "ALTER ROLE {env:DB_USER} SET timezone TO 'UTC'"
psql -h {env:DB_HOST} -p {env:DB_PORT} -U postgres -c "ALTER USER {env:DB_USER} CREATEDB"
psql -h {env:DB_HOST} -p {env:DB_PORT} -U postgres -c "CREATE DATABASE {env:DB_NAME} OWNER='{env:DB_USER}'"
commands = python -c ""
commands_post =
rm -rf {toxinidir}/deploy_askbot
rm -rf {toxinidir}/static
[testenv]
depends =
py3: py{36,37,38,py3}
deps =
py{36,37,38,py3}: -raskbot_requirements.txt
-rrequirements-tests.txt
coverage: coverage
lint: pylint
skipsdist=
coverage: true
lint: true
skip_install=
coverage: true
lint: true
changedir = {toxinidir}/testproject/
setenv =
{[envvars]setenv}
commands =
py{36,37,38,py3}: {[unittests]commands}
coverage: {[coverage]commands}
lint: {[lint]commands}
setup: {[setup]commands}
whitelist_externals =
setup: {[setup]whitelist_externals}
commands_pre =
setup: {[setup]commands_pre}
commands_post =
setup: {[setup]commands_post}