-
Notifications
You must be signed in to change notification settings - Fork 8
/
tox.ini
88 lines (78 loc) · 2.61 KB
/
tox.ini
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
[tox]
envlist = black,flake8,isort,mypy,schema,secrets,corgi,corgi-migrations
skipsdist = true
[testenv]
basepython = python3.11
passenv =
CORGI_DB_USER
CORGI_DB_PASSWORD
CORGI_DB_HOST
CORGI_DB_HOST_RO
CORGI_DB_PORT
# Internal hostnames or URLs that appear in build metadata; used in tests
CORGI_APP_INTERFACE_URL
# Not used in tests directly, but needed for tests to pass
CORGI_APP_STREAMS_LIFE_CYCLE_URL
CORGI_BREW_URL
CORGI_BREW_DOWNLOAD_ROOT_URL
CORGI_DOMAIN
CORGI_ERRATA_TOOL_URL
CORGI_LOOKASIDE_CACHE_URL
CORGI_MANIFEST_HINTS_URL
CORGI_PRODDEFS_DATA_URL
CORGI_PULP_URL
CORGI_PYXIS_GRAPHQL_URL
CORGI_UMB_CERT
CORGI_UMB_KEY
PIP_INDEX_URL
REQUESTS_CA_BUNDLE
setenv =
DJANGO_SETTINGS_MODULE=config.settings.test
GOCACHE=/tmp
GOPATH=/tmp
[testenv:corgi]
deps = -r requirements/test.txt
commands =
pytest {posargs}
[testenv:corgi-migrations]
deps = -r requirements/test.txt
commands =
python3 manage.py makemigrations --dry-run --check
python3 manage.py makemigrations collectors --dry-run --check
pytest --migrations --no-cov tests/test_migrations.py {posargs}
[flake8]
# NOTE: Any ignored errors/warnings specified below are subjective and can be changed based on
# common agreement of all developers contributing to this project.
#
# E203: whitespace before ':' (ignored per Black documentation, non PEP8-compliant)
#
# TODO: move config to pyproject.toml once https://github.com/PyCQA/flake8/issues/234 is resolved
extend-ignore = E203
# Keep in sync with black.line-length in pyproject.toml
max-line-length = 100
exclude = .git/,venv/,.tox/
[testenv:flake8]
deps = -r requirements/lint.txt
commands = flake8 {posargs}
[testenv:black]
deps = -r requirements/lint.txt
commands = black --check --diff {posargs:.}
[testenv:isort]
deps = -r requirements/lint.txt
commands = isort --check --diff {posargs:.}
[testenv:mypy]
deps = -r requirements/test.txt
commands = mypy {posargs:corgi}
[testenv:schema]
deps = -r requirements/base.txt
allowlist_externals = /usr/bin/git
commands = python3 manage.py spectacular --file openapi.yml {posargs}
/usr/bin/git diff --quiet openapi.yml
[testenv:secrets]
deps = -r requirements/lint.txt
allowlist_externals = /usr/bin/bash
# Check only files in the current branch which have changed, compared to the main branch, for secrets
# Scan all files for secrets if the first form fails, since Gitlab CI uses shallow clone and does not have a "main" ref
commands = /usr/bin/bash -c 'detect-secrets-hook --baseline .secrets.baseline \
$(git diff --name-only "origin/main..HEAD" || \
git ls-files)'