Reorganize tox.ini.

- The environment to run unittests is now called py34 as that's the common
  thing used, and will also allow us to run the tests with Python 3.5.
- The default tests now also run coverage.py and do a coverage check (on
  Linux).
- The smoke tests are now part of the default environment.
This commit is contained in:
Florian Bruhin 2015-08-08 21:11:38 +02:00
parent 06a82c5566
commit 3179455e69
6 changed files with 57 additions and 51 deletions

View File

@ -12,9 +12,8 @@ install:
- C:\Python27\python -u scripts\dev\ci_install.py - C:\Python27\python -u scripts\dev\ci_install.py
test_script: test_script:
- C:\Python34\Scripts\tox -e smoke - C:\Python34\Scripts\tox -e py34
- C:\Python34\Scripts\tox -e smoke-frozen
- C:\Python34\Scripts\tox -e unittests
- C:\Python34\Scripts\tox -e unittests-frozen - C:\Python34\Scripts\tox -e unittests-frozen
- C:\Python34\Scripts\tox -e smoke-frozen
- C:\Python34\Scripts\tox -e pyflakes - C:\Python34\Scripts\tox -e pyflakes
- C:\Python34\Scripts\tox -e pylint - C:\Python34\Scripts\tox -e pylint

View File

@ -12,3 +12,9 @@ exclude_lines =
raise AssertionError raise AssertionError
raise NotImplementedError raise NotImplementedError
if __name__ == ["']__main__["']: if __name__ == ["']__main__["']:
[html]
directory=.htmlcov
[xml]
output=.coverage.xml

4
.gitignore vendored
View File

@ -20,8 +20,8 @@ __pycache__
/qutebrowser/html/doc/ /qutebrowser/html/doc/
/.venv /.venv
/.coverage /.coverage
/htmlcov /.htmlcov
/coverage.xml /.coverage.xml
/.tox /.tox
/testresults.html /testresults.html
/.cache /.cache

View File

@ -17,7 +17,7 @@ install:
- python scripts/dev/ci_install.py - python scripts/dev/ci_install.py
script: script:
- xvfb-run -s "-screen 0 640x480x16" tox -e unittests,smoke - xvfb-run -s "-screen 0 640x480x16" tox -e py34
- tox -e misc - tox -e misc
- tox -e pep257 - tox -e pep257
- tox -e pyflakes - tox -e pyflakes

View File

@ -67,10 +67,14 @@ def main():
""" """
utils.change_cwd() utils.change_cwd()
if sys.platform != 'linux':
print("Skipping coverage checks on non-Linux system.")
sys.exit()
for path in PERFECT_FILES: for path in PERFECT_FILES:
assert os.path.exists(os.path.join(*path.split('/'))), path assert os.path.exists(os.path.join(*path.split('/'))), path
with open('coverage.xml', encoding='utf-8') as f: with open('.coverage.xml', encoding='utf-8') as f:
tree = ElementTree.parse(f) tree = ElementTree.parse(f)
classes = tree.getroot().findall('./packages/package/classes/class') classes = tree.getroot().findall('./packages/package/classes/class')

85
tox.ini
View File

@ -4,23 +4,14 @@
# and then run "tox" from this directory. # and then run "tox" from this directory.
[tox] [tox]
envlist = smoke,unittests,misc,pep257,pyflakes,pep8,mccabe,pylint,pyroma,check-manifest envlist = smoke,py34,misc,pep257,pyflakes,pep8,mccabe,pylint,pyroma,check-manifest
[testenv] [testenv]
passenv = PYTHON
basepython = python3
[testenv:mkvenv]
commands = {envpython} scripts/link_pyqt.py --tox {envdir}
envdir = {toxinidir}/.venv
usedevelop = true
[testenv:unittests]
# https://bitbucket.org/hpk42/tox/issue/246/ - only needed for Windows though # https://bitbucket.org/hpk42/tox/issue/246/ - only needed for Windows though
setenv = setenv =
QT_QPA_PLATFORM_PLUGIN_PATH={envdir}/Lib/site-packages/PyQt5/plugins/platforms QT_QPA_PLATFORM_PLUGIN_PATH={envdir}/Lib/site-packages/PyQt5/plugins/platforms
PYTEST_QT_API=pyqt5 PYTEST_QT_API=pyqt5
passenv = PYTHON DISPLAY XAUTHORITY HOME passenv = PYTHON DISPLAY XAUTHORITY HOME USERNAME USER
deps = deps =
-r{toxinidir}/requirements.txt -r{toxinidir}/requirements.txt
py==1.4.30 py==1.4.30
@ -31,15 +22,26 @@ deps =
pytest-html==1.3.2 pytest-html==1.3.2
hypothesis==1.10.1 hypothesis==1.10.1
hypothesis-pytest==0.15.1 hypothesis-pytest==0.15.1
coverage==3.7.1
pytest-cov==2.0.0
cov-core==1.15.0
commands = commands =
{envpython} scripts/link_pyqt.py --tox {envdir} {envpython} scripts/link_pyqt.py --tox {envdir}
{envpython} -m py.test --strict -rfEsw {posargs:tests} {envpython} -m py.test --strict -rfEsw --cov qutebrowser --cov-report html --cov-report xml --cov-report= {posargs:tests}
{envpython} scripts/dev/check_coverage.py
{envpython} -m qutebrowser --no-err-windows --nowindow --temp-basedir about:blank ":later 500 quit"
[testenv:mkvenv]
basepython = python3
commands = {envpython} scripts/link_pyqt.py --tox {envdir}
envdir = {toxinidir}/.venv
usedevelop = true
[testenv:unittests-watch] [testenv:unittests-watch]
setenv = {[testenv:unittests]setenv} basepython = python3
passenv = {[testenv:unittests]passenv} passenv = {[testenv]passenv}
deps = deps =
{[testenv:unittests]deps} {[testenv]deps}
pytest-testmon==0.6 pytest-testmon==0.6
pytest-watch==3.2.0 pytest-watch==3.2.0
commands = commands =
@ -47,40 +49,32 @@ commands =
{envdir}/bin/ptw -- --testmon --strict -rfEsw {posargs:tests} {envdir}/bin/ptw -- --testmon --strict -rfEsw {posargs:tests}
[testenv:unittests-frozen] [testenv:unittests-frozen]
setenv = {[testenv:unittests]setenv} basepython = python3
passenv = {[testenv:unittests]passenv} passenv = {[testenv]passenv}
skip_install = true skip_install = true
deps = deps =
{[testenv:unittests]deps} {[testenv]deps}
cx_Freeze==4.3.4 cx_Freeze==4.3.4
commands = commands =
{envpython} scripts/link_pyqt.py --tox {envdir} {envpython} scripts/link_pyqt.py --tox {envdir}
{envpython} scripts/dev/freeze_tests.py build_exe -b {envdir}/build {envpython} scripts/dev/freeze_tests.py build_exe -b {envdir}/build
{envdir}/build/run-frozen-tests --strict -rfEsw {posargs} {envdir}/build/run-frozen-tests --strict -rfEsw {posargs}
[testenv:coverage]
passenv = PYTHON DISPLAY XAUTHORITY HOME
deps =
{[testenv:unittests]deps}
coverage==3.7.1
pytest-cov==2.0.0
cov-core==1.15.0
commands =
{envpython} scripts/link_pyqt.py --tox {envdir}
{envpython} -m py.test --strict -rfEswx -v --cov qutebrowser --cov-report term --cov-report html --cov-report xml {posargs:tests}
{envpython} scripts/dev/check_coverage.py
[testenv:misc] [testenv:misc]
basepython = python3
# For global .gitignore files # For global .gitignore files
passenv = HOME passenv = HOME
deps =
commands = commands =
{envpython} scripts/dev/misc_checks.py git {envpython} scripts/dev/misc_checks.py git
{envpython} scripts/dev/misc_checks.py vcs {envpython} scripts/dev/misc_checks.py vcs
{envpython} scripts/dev/misc_checks.py spelling {envpython} scripts/dev/misc_checks.py spelling
[testenv:pylint] [testenv:pylint]
basepython = python3
skip_install = true skip_install = true
setenv = PYTHONPATH={toxinidir}/scripts/dev setenv = PYTHONPATH={toxinidir}/scripts/dev
passenv =
deps = deps =
-r{toxinidir}/requirements.txt -r{toxinidir}/requirements.txt
astroid==1.3.8 astroid==1.3.8
@ -95,9 +89,10 @@ commands =
{envpython} scripts/dev/run_pylint_on_tests.py --rcfile=.pylintrc --output-format=colorized --reports=no --expected-line-ending-format=LF {envpython} scripts/dev/run_pylint_on_tests.py --rcfile=.pylintrc --output-format=colorized --reports=no --expected-line-ending-format=LF
[testenv:pep257] [testenv:pep257]
basepython = python3
skip_install = true skip_install = true
deps = pep257==0.6.0
passenv = PYTHON LANG passenv = PYTHON LANG
deps = pep257==0.6.0
# Disabled checks: # Disabled checks:
# D102: Missing docstring in public method (will be handled by others) # D102: Missing docstring in public method (will be handled by others)
# D103: Missing docstring in public function (will be handled by others) # D103: Missing docstring in public function (will be handled by others)
@ -106,8 +101,10 @@ passenv = PYTHON LANG
commands = {envpython} -m pep257 scripts tests qutebrowser --ignore=D102,D103,D209,D402 '--match=(?!resources|test_*).*\.py' commands = {envpython} -m pep257 scripts tests qutebrowser --ignore=D102,D103,D209,D402 '--match=(?!resources|test_*).*\.py'
[testenv:pyflakes] [testenv:pyflakes]
basepython = python3
# https://github.com/fschulze/pytest-flakes/issues/6 # https://github.com/fschulze/pytest-flakes/issues/6
setenv = LANG=en_US.UTF-8 setenv = LANG=en_US.UTF-8
passenv =
deps = deps =
-r{toxinidir}/requirements.txt -r{toxinidir}/requirements.txt
py==1.4.30 py==1.4.30
@ -119,6 +116,8 @@ commands =
{envpython} -m py.test -q --flakes --ignore=tests {envpython} -m py.test -q --flakes --ignore=tests
[testenv:pep8] [testenv:pep8]
basepython = python3
passenv =
deps = deps =
-r{toxinidir}/requirements.txt -r{toxinidir}/requirements.txt
py==1.4.30 py==1.4.30
@ -130,6 +129,8 @@ commands =
{envpython} -m py.test -q --pep8 --ignore=tests {envpython} -m py.test -q --pep8 --ignore=tests
[testenv:mccabe] [testenv:mccabe]
basepython = python3
passenv =
deps = deps =
-r{toxinidir}/requirements.txt -r{toxinidir}/requirements.txt
py==1.4.30 py==1.4.30
@ -141,7 +142,9 @@ commands =
{envpython} -m py.test -q --mccabe --ignore=tests {envpython} -m py.test -q --mccabe --ignore=tests
[testenv:pyroma] [testenv:pyroma]
basepython = python3
skip_install = true skip_install = true
passenv =
deps = deps =
pyroma==1.8.2 pyroma==1.8.2
docutils==0.12 docutils==0.12
@ -150,7 +153,9 @@ commands =
{envdir}/bin/pyroma . {envdir}/bin/pyroma .
[testenv:check-manifest] [testenv:check-manifest]
basepython = python3
skip_install = true skip_install = true
passenv =
deps = deps =
check-manifest==0.25 check-manifest==0.25
commands = commands =
@ -158,8 +163,10 @@ commands =
{envdir}/bin/check-manifest --ignore 'qutebrowser/git-commit-id,qutebrowser/html/doc,qutebrowser/html/doc/*,*/__pycache__' {envdir}/bin/check-manifest --ignore 'qutebrowser/git-commit-id,qutebrowser/html/doc,qutebrowser/html/doc/*,*/__pycache__'
[testenv:docs] [testenv:docs]
basepython = python3
skip_install = true skip_install = true
whitelist_externals = git whitelist_externals = git
passenv =
deps = deps =
-r{toxinidir}/requirements.txt -r{toxinidir}/requirements.txt
commands = commands =
@ -168,22 +175,12 @@ commands =
git --no-pager diff --exit-code --stat git --no-pager diff --exit-code --stat
{envpython} scripts/asciidoc2html.py {posargs} {envpython} scripts/asciidoc2html.py {posargs}
[testenv:smoke]
# https://bitbucket.org/hpk42/tox/issue/246/ - only needed for Windows though
setenv = QT_QPA_PLATFORM_PLUGIN_PATH={envdir}/Lib/site-packages/PyQt5/plugins/platforms
passenv = PYTHON DISPLAY XAUTHORITY HOME USERNAME USER
deps =
-r{toxinidir}/requirements.txt
commands =
{envpython} scripts/link_pyqt.py --tox {envdir}
{envpython} -m qutebrowser --no-err-windows --nowindow --temp-basedir about:blank ":later 500 quit"
[testenv:smoke-frozen] [testenv:smoke-frozen]
setenv = {[testenv:smoke]setenv} basepython = python3
passenv = {[testenv:smoke]passenv} passenv = {[testenv]passenv}
skip_install = true skip_install = true
deps = deps =
{[testenv:smoke]deps} {[testenv]deps}
cx_Freeze==4.3.4 cx_Freeze==4.3.4
commands = commands =
{envpython} scripts/link_pyqt.py --tox {envdir} {envpython} scripts/link_pyqt.py --tox {envdir}