forked from RedHatProductSecurity/component-registry
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtox.ini
103 lines (90 loc) · 3.14 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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
[tox]
envlist = bandit,black,flake8,isort,mypy,radon,schema,secrets,corgi,corgi-migrations
skipsdist = true
[testenv]
basepython = python3.9
passenv =
CORGI_DB_USER
CORGI_DB_PASSWORD
CORGI_DB_HOST
CORGI_DB_PORT
# Internal hostnames or URLs that appear in build metadata; used in tests
CORGI_TEST_CACHITO_URL
CORGI_TEST_CODE_URL
CORGI_TEST_DOWNLOAD_URL
CORGI_TEST_OSBS_HOST1
CORGI_TEST_OSBS_HOST2
CORGI_TEST_OSBS_HOST3
CORGI_LOOKASIDE_CACHE_URL
CORGI_TEST_REGISTRY_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_ERRATA_TOOL_URL
CORGI_MANIFEST_HINTS_URL
CORGI_PRODSEC_DASHBOARD_URL
PIP_INDEX_URL
REQUESTS_CA_BUNDLE
setenv =
DJANGO_SETTINGS_MODULE=config.settings.test
[testenv:corgi]
deps = -r requirements/test.txt
commands =
pytest {posargs}
[testenv:corgi-vcr-record-rewrite]
# Use this test env to force VCR to re-record a cassette (i.e. to ensure the responses are not
# out of date) or can be used when you simply want to log all HTTP requests.
deps = -r requirements/test.txt
commands =
pytest --record-mode=all {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 --record-mode=none tests/test_migrations.py
[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/,tests/data/
[testenv:flake8]
deps = -r requirements/lint.txt
commands = flake8
[testenv:black]
deps = -r requirements/lint.txt
commands = black --check --diff .
[testenv:isort]
deps = -r requirements/lint.txt
commands = isort --check --diff .
[testenv:mypy]
deps = -r requirements/test.txt
commands = mypy corgi
[testenv:bandit]
deps = -r requirements/lint.txt
commands = bandit -r corgi
[testenv:radon]
# NOTE: radon module cannot read from pyproject.toml just yet
deps = -r requirements/lint.txt
commands = radon cc --ignore tests,venv --min "C" .
radon mi --ignore tests,venv --min "C" .
[testenv:schema]
deps = -r requirements/base.txt
allowlist_externals = git
commands = python3 manage.py spectacular --file openapi.yml
/usr/bin/git diff --quiet openapi.yml
[testenv:secrets]
deps = -r requirements/lint.txt
allowlist_externals = 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)'