Commit ea7a739e authored by Moritz E. Beber's avatar Moritz E. Beber

chore: configure testing

parent e4bb6092
.PHONY: qa
################################################################################
# COMMANDS #
################################################################################
## Apply code quality assurance tools
qa:
isort --recursive src/equilibrator_api tests/ setup.py
black src/equilibrator_api tests/ setup.py
################################################################################
# Self Documenting Commands #
################################################################################
.DEFAULT_GOAL := show-help
# Inspired by
# <http://marmelab.com/blog/2016/02/29/auto-documented-makefile.html>
# sed script explained:
# /^##/:
# * save line in hold space
# * purge line
# * Loop:
# * append newline + line to hold space
# * go to next line
# * if line starts with doc comment, strip comment character off and loop
# * remove target prerequisites
# * append hold space (+ newline) to line
# * replace newline plus comments by `---`
# * print line
# Separate expressions are necessary because labels cannot be delimited by
# semicolon; see <http://stackoverflow.com/a/11799865/1968>
.PHONY: show-help
show-help:
@echo "$$(tput bold)Available rules:$$(tput sgr0)"
@echo
@sed -n -e "/^## / { \
h; \
s/.*//; \
:doc" \
-e "H; \
n; \
s/^## //; \
t doc" \
-e "s/:.*//; \
G; \
s/\\n## /---/; \
s/\\n/ /g; \
p; \
}" ${MAKEFILE_LIST} \
| LC_ALL='C' sort --ignore-case \
| awk -F '---' \
-v ncol=$$(tput cols) \
-v indent=19 \
-v col_on="$$(tput setaf 6)" \
-v col_off="$$(tput sgr0)" \
'{ \
printf "%s%*s%s ", col_on, -indent, $$1, col_off; \
n = split($$2, words, " "); \
line_length = ncol - indent; \
for (i = 1; i <= n; i++) { \
line_length -= length(words[i]) + 1; \
if (line_length <= 0) { \
line_length = ncol - indent - length(words[i]) - 1; \
printf "\n%*s ", -indent, " "; \
} \
printf "%s ", words[i]; \
} \
printf "\n"; \
}' \
| more $(shell test $(shell uname) = Darwin && \
echo '--no-init --raw-control-chars')
......@@ -3,3 +3,13 @@ requires = [
"setuptools>=30.3.0",
"wheel"
]
[tool.black]
line-length = 80
python-version = ['py36']
exclude = '''
(
__init__.py
| _version.py
)
'''
......@@ -58,41 +58,6 @@ universal = 1
[bdist_wheel]
universal = 1
[flake8]
max-line-length = 80
exclude =
__init__.py
_version.py
[pydocstyle]
match_dir = equilibrator_api
[tool:pytest]
filterwarnings =
ignore::DeprecationWarning:libsbml
[isort]
skip = __init__.py
line_length = 80
indent = 4
multi_line_output = 4
lines_after_imports = 2
known_first_party = equilibrator_api
known_third_party =
pytest
numpy
pandas
unittest
scipy
optlang
nltk
pyparsing
sbtab
matplotlib
equilibrator_api
equilibrator_cache
component_contribution
# See the docstring in versioneer.py for instructions. Note that you must
# re-run 'versioneer.py setup' after changing this section, and commit the
# resulting files.
......
[tox]
envlist = flake8, isort, safety, py{36,37}, codecov
envlist = isort, black, flake8, safety, py3{6,7}
[testenv]
setenv =
......@@ -8,35 +8,71 @@ deps =
pytest
pytest-cov
pytest-raises
coverage
commands =
pytest --cov=./
pytest --cov=equilibrator_api {posargs: {toxinidir}/tests}
[testenv:flake8]
[testenv:isort]
skip_install = True
deps=
flake8
flake8-docstrings
isort
commands=
flake8 {toxinidir}/src/equilibrator_api {toxinidir}/tests {toxinidir}/scripts
isort --check-only --diff --recursive {toxinidir}/src/equilibrator_api {toxinidir}/tests
[testenv:isort]
[testenv:black]
skip_install = True
deps=
isort
black
commands=
black --check --diff {toxinidir}/src/equilibrator_api {toxinidir}/tests
[testenv:flake8]
skip_install = True
deps=
flake8
flake8-docstrings
flake8-bugbear
commands=
isort --check-only --diff --recursive {toxinidir}/src/equilibrator_api {toxinidir}/tests {toxinidir}/scripts
flake8 {toxinidir}/src/equilibrator_api {toxinidir}/tests
[testenv:safety]
deps=
safety
commands=
safety check
[testenv:codecov]
passenv=
GITLAB_CI CI_BUILD_REF_NAME CI_BUILD_ID CI_BUILD_REPO CI_BUILD_REF CODECOV_TOKEN
deps=
codecov>=1.4.0
commands=
codecov
[flake8]
max-line-length = 80
exclude =
__init__.py
_version.py
# The following conflict with `black` which is the more pedantic.
ignore =
E203
W503
D202
[isort]
skip = __init__.py
line_length = 80
indent = 4
multi_line_output = 3
include_trailing_comma = true
force_grid_wrap = 0
use_parentheses = true
lines_after_imports = 2
known_first_party = equilibrator_api
known_third_party =
pytest
numpy
pandas
unittest
scipy
optlang
nltk
pyparsing
sbtab
matplotlib
equilibrator_api
equilibrator_api
component_contribution
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment