storyboard/tox.ini
Clark Boylan b502ec35b0 Omnibus fixups for storyboard testing and CI
Linting fails due to two different hacking rules: H214 and H216. We fix
H214 by using assertNotIn and assertIn over assertFalse(foo in bar) and
assertTrue(foo in bar). We ignore H216 as it says don't use the mock
library but storyboard actually does use mock and updating to use
unittest.mock appears to be a fair bit of work.

In the sqlaclhemy models we move some classes around to address this
error:
  sqlalchemy.exc.InvalidRequestError: When initializing mapper mapped
  class Story->stories, expression 'TimeLineEvent' failed to locate a
  name ('TimeLineEvent'). If this is a class name, consider adding this
  relationship() to the <class 'storyboard.db.models.Story'> class after
  both dependent classes have been defined.

In the project loader we switch to using yaml.safe_load() to avoid the
missing Loader argument to yaml.load().

We pin jinja2 to < 3.0.0 as the old sphinx we've pinned to uses
contextfunction which appears to have been replaced in jinja2 3.0.0.
We should probably attempt to update the doc toolchain for storyboard
when we have time.

We pin MarkupSafe for similar reasons to the jinja2 pin. Version 2.1.0
of MarkupSafe removed the soft_unicode name which is used by sphinx.

Finally we run the python 3.6 and 3.7 jobs on ubuntu-bionic.

Change-Id: Ifcb6660ce2c89c21ba867aa88d942461bcff125d
2022-04-18 16:00:35 -07:00

80 lines
2.2 KiB
INI

[tox]
minversion = 2.9.1
skipsdist = True
envlist = py3,pep8
[testenv]
basepython = python3
usedevelop = True
install_command = pip install -U {opts} {packages}
passenv = OS_* STORYBOARD_*
setenv =
VIRTUAL_ENV={envdir}
OS_LOG_CAPTURE={env:OS_LOG_CAPTURE:true}
OS_STDOUT_CAPTURE={env:OS_STDOUT_CAPTURE:true}
OS_STDERR_CAPTURE={env:OS_STDERR_CAPTURE:true}
deps = -r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
commands = stestr run {posargs}
stestr slowest
whitelist_externals = bash
[testenv:sqlite]
setenv =
{[testenv]setenv}
STORYBOARD_TEST_DB=sqlite:///{envtmpdir}
[testenv:pep8]
commands = flake8
[testenv:venv]
commands = {posargs}
[testenv:docs]
deps = -r{toxinidir}/doc/requirements.txt
commands =
rm -rf doc/html doc/build
rm -rf doc/source/apidoc doc/source/api
sphinx-build -W -b html doc/source doc/build/html
whitelist_externals = rm
[testenv:cover]
setenv =
{[testenv]setenv}
PYTHON=coverage run --source storyboard --parallel-mode
commands =
stestr run {posargs}
coverage combine
coverage html -d cover
coverage xml -o cover/coverage.xml
[flake8]
# E125 and E128 are ignored on purpose, they are invalid pep8
# W503 is ignored on purpose, it is no longer valid pep8
# The following rules should either be addressed or determined to be
# skippable long term.
# E265 is ignored to make switch to newer hacking easier
# H216 is ignored to allow use of the mock library instead of unittest.mock
# H405 is ignored to make switch to newer hacking easier
ignore = E125,E128,E265,H216,H405,W503
builtins = _
show-source = True
exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build
[testenv:bindep]
# Do not install any requirements. We want this to be fast and work even if
# system dependencies are missing, since it's used to tell you what system
# dependencies are missing! This also means that bindep must be installed
# separately, outside of the requirements files.
deps = bindep
commands = bindep test
[testenv:lpimport]
# The Launchpad bug import tool uses launchpadlib, which is not a typical
# runtime dependency of anything else in StoryBoard
deps = launchpadlib
commands = storyboard-migrate {posargs}
[hacking]
import_exceptions = storyboard._i18n