diff --git a/.gitignore b/.gitignore index 7eb8cb1e..11b238fc 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,7 @@ build/ node_modules/ public/ +.tox/ *.sqlite3 *.db diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index 590a1062..29c6512e 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -39,12 +39,25 @@ $ optuna-dashboard sqlite:///db.sqlite3 ## Running tests, lint checks and formatters +### Run all tests and lint + +``` +$ tox -e ALL +``` + ### Running Python unit tests ``` $ python -m unittest ``` +or + +``` +$ pip install tox +$ tox -e py39 +``` + ### Linters (flake8, black and mypy) ``` @@ -54,6 +67,13 @@ $ black --check . $ mypy . ``` +or + +``` +$ pip install tox +$ tox -e flake8 -e black -e mypy +``` + ### Auto-formatting TypeScript files (by prettier) ``` diff --git a/setup.cfg b/setup.cfg index 4afda6de..8a6c2350 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,7 +1,7 @@ [flake8] max-line-length = 99 statistics = True -exclude = venv,build +exclude = venv,build,.tox [mypy] ignore_missing_imports = True diff --git a/tox.ini b/tox.ini new file mode 100644 index 00000000..639f92c8 --- /dev/null +++ b/tox.ini @@ -0,0 +1,35 @@ +[tox] +envlist = + py36 + py37 + py38 + py39 + flake8 + black + mypy + +[testenv] +basepython = python3.9 +setenv=PYTHONPATH = {toxinidir}:{toxinidir} +commands = python -m unittest + +[testenv:py36] +basepython = python3.6 + +[testenv:py37] +basepython = python3.7 + +[testenv:py38] +basepython = python3.8 + +[testenv:flake8] +deps = flake8 +commands = flake8 . + +[testenv:black] +deps = black +commands = black --check . + +[testenv:mypy] +deps = mypy +commands = mypy .