2011-12-30 14:03:15 -08:00
|
|
|
[tox]
|
2021-06-03 14:37:10 +08:00
|
|
|
minversion = 3.18.0
|
2019-11-22 10:11:52 -05:00
|
|
|
# python runtimes: https://governance.openstack.org/tc/reference/runtimes/ussuri.html
|
2022-05-10 19:04:16 -05:00
|
|
|
envlist = functional-py39,py39,pep8
|
2019-11-22 10:11:52 -05:00
|
|
|
skip_missing_interpreters = true
|
2011-12-30 14:03:15 -08:00
|
|
|
|
|
|
|
[testenv]
|
2016-09-30 17:07:06 +08:00
|
|
|
setenv =
|
2016-11-14 17:18:34 -06:00
|
|
|
# NOTE(hemanthm): The environment variable "OS_TEST_DBAPI_ADMIN_CONNECTION"
|
|
|
|
# must be set to force oslo.db tests to use a file-based sqlite database
|
|
|
|
# instead of the default in-memory database, which doesn't work well with
|
|
|
|
# alembic migrations. The file-based database pointed by the environment
|
|
|
|
# variable itself is not used for testing. Neither is it ever created. Oslo.db
|
|
|
|
# creates another file-based database for testing purposes and deletes it as a
|
|
|
|
# part of its test clean-up. Think of setting this environment variable as a
|
|
|
|
# clue for oslo.db to use file-based database.
|
|
|
|
OS_TEST_DBAPI_ADMIN_CONNECTION=sqlite:////tmp/placeholder-never-created-nor-used.db
|
2023-07-18 16:57:36 +01:00
|
|
|
# TODO(stephenfin): Remove once we bump our upper-constraint to SQLAlchemy 2.0
|
|
|
|
SQLALCHEMY_WARN_20=1
|
2013-12-03 23:32:07 +11:00
|
|
|
usedevelop = True
|
2022-04-28 18:00:47 +02:00
|
|
|
install_command = python -m pip install -c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master} {opts} {packages}
|
|
|
|
deps = -r{toxinidir}/test-requirements.txt
|
2019-11-12 19:30:46 -05:00
|
|
|
-r{toxinidir}/requirements.txt
|
2016-12-19 14:44:35 -06:00
|
|
|
commands =
|
2017-06-15 19:37:27 -05:00
|
|
|
find . -type f -name "*.pyc" -delete
|
2021-01-14 01:39:33 +01:00
|
|
|
stestr run --slowest {posargs}
|
2021-06-03 14:37:10 +08:00
|
|
|
allowlist_externals = bash
|
2017-06-15 19:37:27 -05:00
|
|
|
find
|
|
|
|
rm
|
2022-12-24 19:26:39 -08:00
|
|
|
passenv =
|
|
|
|
*_proxy
|
|
|
|
*_PROXY
|
2012-06-03 09:54:51 -04:00
|
|
|
|
2017-06-15 19:37:27 -05:00
|
|
|
[testenv:functional]
|
2017-10-09 14:18:51 +08:00
|
|
|
setenv =
|
2017-06-15 19:37:27 -05:00
|
|
|
TEST_PATH = ./glance/tests/functional
|
2023-07-18 16:57:36 +01:00
|
|
|
# TODO(stephenfin): Remove once we bump our upper-constraint to SQLAlchemy 2.0
|
|
|
|
SQLALCHEMY_WARN_20=1
|
2019-11-22 10:11:52 -05:00
|
|
|
commands = stestr run {posargs}
|
2017-06-15 19:37:27 -05:00
|
|
|
|
2024-05-20 20:27:36 +02:00
|
|
|
[testenv:functional-py{38,39,310,311,312}]
|
2021-01-14 01:39:33 +01:00
|
|
|
setenv = {[testenv:functional]setenv}
|
|
|
|
commands = {[testenv:functional]commands}
|
|
|
|
|
2021-06-30 09:28:52 -07:00
|
|
|
[testenv:functional-py38-rbac]
|
|
|
|
setenv =
|
|
|
|
{[testenv:functional]setenv}
|
|
|
|
OS_GLANCE_TEST_RBAC_DEFAULTS = True
|
|
|
|
commands = {[testenv:functional]commands}
|
|
|
|
|
2021-12-13 20:57:28 -06:00
|
|
|
[testenv:functional-py39-rbac]
|
|
|
|
setenv =
|
|
|
|
{[testenv:functional]setenv}
|
|
|
|
OS_GLANCE_TEST_RBAC_DEFAULTS = True
|
|
|
|
commands = {[testenv:functional]commands}
|
|
|
|
|
Move policy defaults into code
Instead of a default policy.json file, policy defaults are now defined
in code. An operator need not supply policy.json data except to the
extent they want to override the defaults. Currently an empty
policy.json is still shipped because it is expected by devstack, but
this can be removed later. A sample policy.yaml file can be generated
using the genpolicy tox environment.
This partly fulfils the requirements of the policy in code goal[1].
However, because policies don't map 1:1 with APIs, it will not be
possible to fully document the policies until changes are made in how
policies are applied as proposed in https://review.opendev.org/528021
Due to the fact that existing policy files may rely on a rule named
"default" to specifiy policies not explicitly listed in the policy.json
file, all policies that are not admin-only by default now default to
"rule:default", so that the "default" rule will continue to apply to
those policies that are not listed in policy.json.
To ensure that this yields the expected policy in a standard
policy-in-code config file, the default value of the "default" rule is
now the empty string "". This is a change; between the Queens release
and now the default was set to "role:admin" to match the value specified
in the default policy.json file. An installation relying on both the
"default" rule for some policies and the default value of the default
rule may end up with a more permissive policy after upgrading. It's
likely that no such policies exist in the wild, because prior to the
Queens release the default value for the "default" rule was "@" (allow
all requests), so anybody relying on this rule will surely have
specified it explicitly in their policy.json.
Policies whose default is "role:admin" no longer use the "default" rule.
Therefore existing policy.json files that rely on the "default" rule for
those policies, and who have specified a value for the "default" rule
that is more permissive, will result in a more restrictive policy after
upgrading. It is unlikely that any of these policies exist in the wild
either.
[1] https://governance.openstack.org/tc/goals/selected/queens/policy-in-code.html
Change-Id: I8d1ccf5844078cc0b1652fb1130794daf07cedbc
2019-11-06 15:26:58 +08:00
|
|
|
[testenv:genpolicy]
|
|
|
|
commands =
|
|
|
|
oslopolicy-sample-generator --config-file=etc/glance-policy-generator.conf
|
|
|
|
|
2011-12-30 14:03:15 -08:00
|
|
|
[testenv:pep8]
|
2012-11-09 12:56:25 -05:00
|
|
|
commands =
|
2013-12-03 23:32:07 +11:00
|
|
|
flake8 {posargs}
|
2017-11-16 14:55:19 +07:00
|
|
|
doc8 {posargs}
|
2011-12-30 14:03:15 -08:00
|
|
|
|
2014-03-27 17:39:14 +08:00
|
|
|
[testenv:genconfig]
|
|
|
|
commands =
|
|
|
|
oslo-config-generator --config-file etc/oslo-config-generator/glance-api.conf
|
|
|
|
oslo-config-generator --config-file etc/oslo-config-generator/glance-scrubber.conf
|
|
|
|
oslo-config-generator --config-file etc/oslo-config-generator/glance-cache.conf
|
|
|
|
oslo-config-generator --config-file etc/oslo-config-generator/glance-manage.conf
|
2017-10-24 16:12:06 +05:30
|
|
|
oslo-config-generator --config-file etc/oslo-config-generator/glance-image-import.conf
|
2014-03-27 17:39:14 +08:00
|
|
|
|
WADL to RST migration (part 1)
This brings the Images API Reference to the glance tree as part of
the effort described here:
https://wiki.openstack.org/wiki/Documentation/Migrate#API_Reference_Plan
This patch introduces (a) the tox environment to generate the api-ref,
and (b) the content of the Images v1 API reference converted to RST.
The content has been corrected where I noticed divergences with reality.
Note to reviewers: The conversion project is ongoing, that is, the doc
team is continuing to develop tools (for example, to display the response
codes in a table) and converging on a style for these docs. So this isn't
a final product, there will be more patches later. While this patch is
not perfect, it is pareto-optimal with respect to content (it's at least
as good as the current guide, and better in at least one place). Thus
my advice, should you choose to take it, is that we should merge this
patch to get these docs in-tree, and make improvements as additional
patches that can focus on particular API calls rather than try to get
everything perfect on this patch.
Change-Id: I51dfaf1832108466f115ab183838c5f28e138312
2016-05-03 17:27:58 -04:00
|
|
|
[testenv:api-ref]
|
|
|
|
# This environment is called from CI scripts to test and publish
|
2019-07-22 18:46:16 +02:00
|
|
|
# the API Ref to docs.openstack.org.
|
2018-03-22 17:23:30 +09:00
|
|
|
deps =
|
|
|
|
-r{toxinidir}/doc/requirements.txt
|
WADL to RST migration (part 1)
This brings the Images API Reference to the glance tree as part of
the effort described here:
https://wiki.openstack.org/wiki/Documentation/Migrate#API_Reference_Plan
This patch introduces (a) the tox environment to generate the api-ref,
and (b) the content of the Images v1 API reference converted to RST.
The content has been corrected where I noticed divergences with reality.
Note to reviewers: The conversion project is ongoing, that is, the doc
team is continuing to develop tools (for example, to display the response
codes in a table) and converging on a style for these docs. So this isn't
a final product, there will be more patches later. While this patch is
not perfect, it is pareto-optimal with respect to content (it's at least
as good as the current guide, and better in at least one place). Thus
my advice, should you choose to take it, is that we should merge this
patch to get these docs in-tree, and make improvements as additional
patches that can focus on particular API calls rather than try to get
everything perfect on this patch.
Change-Id: I51dfaf1832108466f115ab183838c5f28e138312
2016-05-03 17:27:58 -04:00
|
|
|
commands =
|
|
|
|
rm -rf api-ref/build
|
|
|
|
sphinx-build -W -b html -d api-ref/build/doctrees api-ref/source api-ref/build/html
|
|
|
|
|
2017-05-25 22:36:51 +02:00
|
|
|
[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, and develop mode disabled
|
|
|
|
# explicitly to avoid unnecessarily installing the checked-out repo too (this
|
|
|
|
# further relies on "tox.skipsdist = True" above).
|
|
|
|
deps = bindep
|
|
|
|
commands = bindep test
|
|
|
|
usedevelop = False
|
|
|
|
|
2017-11-16 14:55:19 +07:00
|
|
|
[doc8]
|
2022-03-11 13:27:26 -05:00
|
|
|
ignore-path = .venv,.git,.tox,.eggs,*glance/locale*,*lib/python*,glance.egg*,api-ref/build,doc/build,doc/source/contributor/api,doc/test
|
2017-11-16 14:55:19 +07:00
|
|
|
|
2013-04-20 22:28:31 -07:00
|
|
|
[flake8]
|
2013-06-09 10:46:50 +02:00
|
|
|
# TODO(dmllr): Analyze or fix the warnings blacklisted below
|
2017-10-28 18:27:40 +02:00
|
|
|
# E402 module level import not at top of file
|
2013-06-09 10:46:50 +02:00
|
|
|
# E711 comparison to None should be 'if cond is not None:'
|
|
|
|
# E712 comparison to True should be 'if cond is True:' or 'if cond:'
|
|
|
|
# H404 multi line docstring should start with a summary
|
2014-06-12 15:36:21 +02:00
|
|
|
# H405 multi line docstring summary not separated with an empty line
|
2017-10-28 18:27:40 +02:00
|
|
|
# W503 line break before binary operator - conflicting guidance
|
|
|
|
# W504 line break after binary operator - conflicting guidance
|
|
|
|
ignore = E402,E711,E712,H404,H405,W503,W504
|
2021-07-28 02:52:51 +02:00
|
|
|
enable-extensions = H904
|
2015-08-31 18:21:24 +02:00
|
|
|
exclude = .venv,.git,.tox,dist,doc,etc,*glance/locale*,*lib/python*,*egg,build
|
2023-04-12 20:31:05 +02:00
|
|
|
per-file-ignores = glance/tests/functional/__init__.py:E501
|
2014-05-09 12:33:21 +02:00
|
|
|
|
|
|
|
[hacking]
|
2015-09-29 14:39:41 +03:00
|
|
|
import_exceptions = glance.i18n
|
2017-06-15 19:37:27 -05:00
|
|
|
|
2020-04-02 15:28:28 +02:00
|
|
|
[flake8:local-plugins]
|
|
|
|
extension =
|
|
|
|
G316 = checks:assert_true_instance
|
|
|
|
G317 = checks:assert_equal_type
|
|
|
|
G318 = checks:assert_equal_none
|
|
|
|
G319 = checks:no_translate_debug_logs
|
|
|
|
G327 = checks:check_no_contextlib_nested
|
|
|
|
G328 = checks:dict_constructor_with_list_copy
|
2021-11-29 16:37:38 +09:00
|
|
|
G330 = checks:no_log_warn
|
2020-04-02 15:28:28 +02:00
|
|
|
paths = ./glance/hacking
|
|
|
|
|
2017-06-15 19:37:27 -05:00
|
|
|
[testenv:docs]
|
2018-03-22 17:23:30 +09:00
|
|
|
deps =
|
|
|
|
-r{toxinidir}/doc/requirements.txt
|
2017-06-15 19:37:27 -05:00
|
|
|
commands =
|
|
|
|
rm -fr doc/build
|
2023-06-28 20:36:55 -04:00
|
|
|
rm -fr doc/source/contributor/api
|
2018-03-22 17:23:30 +09:00
|
|
|
sphinx-build -W -b html doc/source doc/build/html
|
2018-04-24 19:19:16 -04:00
|
|
|
whereto doc/source/_extra/.htaccess doc/test/redirect-tests.txt
|
2017-06-15 19:37:27 -05:00
|
|
|
|
|
|
|
[testenv:venv]
|
2020-04-13 15:34:11 -05:00
|
|
|
deps =
|
|
|
|
{[testenv]deps}
|
|
|
|
-r{toxinidir}/doc/requirements.txt
|
2017-06-15 19:37:27 -05:00
|
|
|
commands = {posargs}
|
|
|
|
|
|
|
|
[testenv:releasenotes]
|
2018-03-22 17:23:30 +09:00
|
|
|
deps =
|
|
|
|
-r{toxinidir}/doc/requirements.txt
|
2017-06-15 19:37:27 -05:00
|
|
|
commands =
|
|
|
|
sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html
|
|
|
|
|
|
|
|
[testenv:cover]
|
|
|
|
setenv =
|
|
|
|
PYTHON=coverage run --source glance --parallel-mode
|
|
|
|
commands =
|
|
|
|
stestr run {posargs}
|
|
|
|
coverage combine
|
|
|
|
coverage html -d cover
|
|
|
|
coverage xml -o cover/coverage.xml
|
|
|
|
|
|
|
|
[testenv:debug]
|
2019-11-22 10:11:52 -05:00
|
|
|
# this will use whatever the system python3 is
|
2017-06-15 19:37:27 -05:00
|
|
|
commands =
|
|
|
|
oslo_debug_helper {posargs}
|
|
|
|
|
2019-11-22 10:11:52 -05:00
|
|
|
[testenv:debug-py38]
|
2017-06-15 19:37:27 -05:00
|
|
|
commands =
|
|
|
|
oslo_debug_helper {posargs}
|
2021-12-13 20:57:28 -06:00
|
|
|
|
|
|
|
[testenv:debug-py39]
|
|
|
|
commands =
|
|
|
|
oslo_debug_helper {posargs}
|