From cfbb9331c0bfed290c8218829e30afc3e3e8d6ad Mon Sep 17 00:00:00 2001 From: Frank Harrison Date: Wed, 1 Apr 2020 12:13:26 +0100 Subject: [PATCH] benchmark| Add benchmarking option to tox --- tox.ini | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/tox.ini b/tox.ini index a6df70a14a..7179ce33ae 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py35, py36, py37, py38, pypy, pylint +envlist = py35, py36, py37, py38, pypy, pylint, benchmark skip_missing_interpreters = true [testenv:pylint] @@ -53,12 +53,14 @@ deps = mccabe pytest pytest-xdist + pytest-benchmark setenv = COVERAGE_FILE = {toxinidir}/.coverage.{envname} commands = - python -Wignore -m coverage run -m pytest {toxinidir}/tests/ {posargs:} + ; Run tests, ensuring all benchmark tests do not run + python -Wignore -m coverage run -m pytest --benchmark-disable {toxinidir}/tests/ {posargs:} ; Transform absolute path to relative path ; for compatibility with coveralls.io and fix 'source not available' error. @@ -131,3 +133,29 @@ commands = rm -f extensions.rst python ./exts/pylint_extensions.py sphinx-build -W -b html -d _build/doctrees . _build/html + +[testenv:benchmark] +deps = + https://github.com/PyCQA/astroid/tarball/master#egg=astroid-master-2.0 + coverage<5.0 + isort + mccabe + pytest + pytest-xdist + pygal + pytest-benchmark + +commands = + ; Run the only the benchmark tests, grouping output and forcing .json output so we + ; can compare benchmark runs + python -Wi -m pytest --exitfirst \ + --failed-first \ + --benchmark-only \ + --benchmark-save=batch_files \ + --benchmark-save-data \ + --benchmark-autosave \ + {toxinidir}/tests \ + --benchmark-group-by="group" \ + {posargs:} + +changedir = {toxworkdir}