1# ============================================================================
2# TOX CONFIGURATION: behave
3# ============================================================================
4# DESCRIPTION:
5#
6#   Use tox to run tasks (tests, ...) in a clean virtual environment.
7#   Afterwards you can run tox in offline mode, like:
8#
9#       tox -e py27
10#
11#   Tox can be configured for offline usage.
12#   Initialize local workspace once (download packages, create PyPI index):
13#
14#       tox -e init1
15#       tox -e init2    (alternative)
16#
17#   NOTE:
18#   You can either use "local1" or "local2" as local "tox.indexserver.default":
19#
20#     * $HOME/.pip/downloads/       (local1, default)
21#     * downloads/                  (local2, alternative)
22#
23# SEE ALSO:
24#   * http://tox.testrun.org/latest/config.html
25# ============================================================================
26# -- ONLINE USAGE:
27# PIP_INDEX_URL = http://pypi.python.org/simple
28
29[tox]
30minversion   = 2.3
31envlist      = py26, py27, py33, py34, py35, py36, pypy, docs
32skip_missing_interpreters = True
33sitepackages = False
34indexserver =
35    default  = https://pypi.python.org/simple
36    default2 = file://{homedir}/.pip/downloads/simple
37    local1   = file://{toxinidir}/downloads/simple
38    local2   = file://{homedir}/.pip/downloads/simple
39    pypi     = https://pypi.python.org/simple
40
41# -----------------------------------------------------------------------------
42# TOX PREPARE/BOOTSTRAP: Initialize local workspace for tox off-line usage
43# -----------------------------------------------------------------------------
44[testenv:init1]
45install_command = pip install -i https://pypi.python.org/simple --find-links downloads --no-index {packages}
46changedir = {toxinidir}
47skipsdist = True
48commands=
49    {toxinidir}/bin/toxcmd.py mkdir {toxinidir}/downloads
50    pip install --download={toxinidir}/downloads -r py.requirements/all.txt
51    {toxinidir}/bin/make_localpi.py {toxinidir}/downloads
52deps=
53
54
55[testenv:init2]
56install_command = pip install -i https://pypi.python.org/simple --find-links {homedir}/.pip/downloads --no-index {packages}
57changedir = {toxinidir}
58skipsdist = True
59commands=
60    {toxinidir}/bin/toxcmd.py mkdir {homedir}/.pip/downloads
61    pip install --download={homedir}/.pip/downloads -r py.requirements/all.txt
62    {toxinidir}/bin/make_localpi.py {homedir}/.pip/downloads
63deps=
64
65# setenv =
66#     PIP_INDEX_URL = https://pypi.python.org/simple
67# -----------------------------------------------------------------------------
68# TEST ENVIRONMENTS:
69# -----------------------------------------------------------------------------
70[testenv]
71install_command = pip install -U {opts} {packages}
72changedir = {toxinidir}
73commands=
74    py.test {posargs:test tests}
75    behave --format=progress {posargs:features}
76    behave --format=progress {posargs:tools/test-features}
77    behave --format=progress {posargs:issue.features}
78deps=
79    pytest>=3.0
80    nose>=1.3
81    mock>=2.0
82    PyHamcrest>=1.9
83    path.py >= 10.1
84setenv =
85     PYTHONPATH = {toxinidir}
86
87
88[testenv:docs]
89basepython= python2
90changedir = docs
91commands=
92    sphinx-build -W -b html -d {envtmpdir}/doctrees . {envtmpdir}/html
93deps=
94    -r{toxinidir}/py.requirements/docs.txt
95
96
97[testenv:cleanroom2]
98basepython = python2
99changedir = {envdir}
100commands=
101    behave --version
102    {toxinidir}/bin/toxcmd.py copytree ../../behave4cmd0 .
103    {toxinidir}/bin/toxcmd.py copytree ../../test .
104    {toxinidir}/bin/toxcmd.py copytree ../../tests .
105    {toxinidir}/bin/toxcmd.py copytree ../../features .
106    {toxinidir}/bin/toxcmd.py copytree ../../tools  .
107    {toxinidir}/bin/toxcmd.py copytree ../../issue.features .
108    {toxinidir}/bin/toxcmd.py copy ../../behave.ini .
109    py.test {posargs:test tests}
110    behave --format=progress {posargs:features}
111    behave --format=progress {posargs:tools/test-features}
112    behave --format=progress {posargs:issue.features}
113deps=
114    {[testenv]deps}
115setenv =
116     PYTHONPATH = .:{envdir}
117
118
119[testenv:cleanroom3]
120basepython = python3
121changedir = {envdir}
122commands=
123    behave --version
124    {toxinidir}/bin/toxcmd.py copytree ../../behave4cmd0 .
125    {toxinidir}/bin/toxcmd.py copytree ../../test .
126    {toxinidir}/bin/toxcmd.py copytree ../../tests .
127    {toxinidir}/bin/toxcmd.py copytree ../../features .
128    {toxinidir}/bin/toxcmd.py copytree ../../tools  .
129    {toxinidir}/bin/toxcmd.py copytree ../../issue.features .
130    {toxinidir}/bin/toxcmd.py copy ../../behave.ini .
131    {toxinidir}/bin/toxcmd.py 2to3 -w -n --no-diffs behave4cmd0
132    {toxinidir}/bin/toxcmd.py 2to3 -w -n --no-diffs test
133    {toxinidir}/bin/toxcmd.py 2to3 -w -n --no-diffs tools
134    {toxinidir}/bin/toxcmd.py 2to3 -w -n --no-diffs features
135    {toxinidir}/bin/toxcmd.py 2to3 -w -n --no-diffs issue.features
136    py.test {posargs:test tests}
137    behave --format=progress {posargs:features}
138    behave --format=progress {posargs:tools/test-features}
139    behave --format=progress {posargs:issue.features}
140deps=
141    {[testenv]deps}
142setenv =
143     PYTHONPATH = .:{envdir}
144
145# ---------------------------------------------------------------------------
146# SELDOM-USED: OPTIONAL TEST ENVIRONMENTS:
147# ---------------------------------------------------------------------------
148# -- SELDOM-USED, TESTED-WITH: jython2.7
149# JYTHON INSTALL RELATED (jit):
150#   http://sikulix-2014.readthedocs.org/en/latest/scenarios.html
151[testenv:jy27]
152basepython= jython
153commands=
154    py.test {posargs:test tests}
155    behave --format=progress {posargs:features}
156    behave --format=progress {posargs:tools/test-features}
157    behave --format=progress {posargs:issue.features}
158deps=
159    jit
160    {[testenv]deps}
161
162