tox now always recreates an env although the env is shared using envdir
options.
~~~
$ tox -e genpolicy
genpolicy: recreate env because env type changed from
{'name': 'genconfig', 'type': 'VirtualEnvRunner'} to
{'name': 'genpolicy', 'type': 'VirtualEnvRunner'}
~~~
According to the maintainer of tox, this functionality is not intended
to be supported.
https://github.com/tox-dev/tox/issues/425#issuecomment-1011944293
Change-Id: I50ac742749b3a58cfd143ce92da72118e497f2af
Updates:
- run py311 func job in gate (was py310)
- add py312 testenvs to tox.ini
- did not remove py38 testenvs from tox.ini
- removed py38 classifier from setup.cfg, but did not change
python_requires (currently it's >=3.8)
Python 3.12 unit tests will run non-voting in the gate as part of the
openstack-python3-jobs template. Python 3.10 coverage is being handled
by tempest running in Ubuntu 22.04.
Change-Id: I72ec22780d36ea3e56386ae2bd74bf5b9806731c
We decided that H301 makes no sense for the "typing"
module, just set that in tox.ini instead of every
time it is used.
Change-Id: Id983fb0a9feef2311bf4b2e6fd70386ab60e974a
These block usage of methods that no longer
exist in oslo.utils 6.0.0+. Since they have
been removed, we don't need a hacking check
for this.
Change-Id: If0345c863b1750eaca3097f240fde9b976ac442e
tox is now too smart for this to work, so just drop it.
pep8: recreate env because env type changed from
{'name': 'fast8', 'type': 'VirtualEnvRunner'} to
{'name': 'pep8', 'type': 'VirtualEnvRunner'}
Change-Id: Ibcaa07a0899e71a06cdaa527c43c14789a16b6e4
The cool new Python linting tool.
"tox -e ruff" to check and
"tox -e ruff -- --fix" to auto-fix code.
This isn't approved in openstack/requirements at this time,
but developers might like trying it out.
Change-Id: I7d39f9043d607b174a53d804a57235a62bbfa6d8
This causes commands like "tox -e py38" to run
the wrong python version in tox4.
It no longer needs to be specified here.
Change-Id: I01e7d03cee797af0fb9a335389328143b63e32ef
Changes:
- eliminate whitespace in passenv values
- account for stricter allowlist checking
- removed skipsdist=True, which in tox 4 appears to prevent cinder
from being installed in the testenvs
- made 4.0.0 the tox minversion, which means tox will have to update
itself until it's available in distros, which in turn means that
the default install_command needs to be used in the base testenv,
which means a new base pyXX testenv is added to include our
install_command that includes upper constraints
- added install_command to most testenvs since they don't inherit
the correct one from the base testenv any more
Not strictly necessary for this patch, but I did them anyway:
- moved the api-ref and releasenotes testenvs to be closer to
the docs testenv
- added reno as a dep for the 'venv' testenv, which our contributor
docs say should be used to generate a new release note from the
reno template, and which has apparently been broken for a while
This patch makes tox 4 the default so that we can hopefully catch
problems locally before they block the gate.
Change-Id: I75e36fa100925bd486c9d4fdf8a33dd58347ce81
We've had broken unit tests for a long time, and we don't realize
because they are always being executed in the same order, and when they
start failing it's harder to understand WHY it is happening.
This patch forces all our unit tests runs to execute tests in a
randomized order to ensure we find bad tests faster.
Change-Id: I1d3107652b6bb9c9f83a54e307165aaa41f100fb
This patch documents in tox.ini the change introduced by change-id
Ic9a6ac412a334710eb5e45935cd301ca80a5edb9 where we use "install_command"
to prevent installing dependencies without constraints.
We document it to prevent people from thinking that just adding the
constraints in "deps" is enough and removing the "install_command" line.
Change-Id: Iccd84cb5d4db78e4953d58a05392c61b08988d4e
Currently, doc8 only runs in the pep8 testenv. Add it to the docs
testenv to make it easier not to submit a patch with an error.
Change-Id: Id8f348109443a7829b5dae91c74dd03c1ea89376
This makes bandit requirements work like our
pylint requirements. (Neither are handled
in the typical way by openstack/requirements.)
This prevents needless installation of bandit
for each unit test job run.
Change-Id: I513de53520a4531067cea4e7a225fb1ad2e9ba06
Well, sort of. We enable them but immediately filter out the ones we're
actually seeing, the rationale being that we can address these in a
piecemeal fashion without the risk of introducing new issues.
There's a lot more to be done here. However, the work done in oslo.db
[1] should provide a guide for how to resolve the outstanding issues.
[1] https://review.opendev.org/q/topic:"sqlalchemy-20"+project:openstack/oslo.db
Change-Id: I9e8d3e3a82c51c3c008ef7380f2f619ed492205e
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
The pylint tox env and job currently only run
on the files changed in HEAD. This is confusing,
because changes regularly merge which introduce new
pylint errors, which will not show up in a pylint
run until another patch touches that file.
Instead, just run pylint on all of Cinder to get
consistent output.
Depends-On: Icb4c0b5cbba02c42e9e2ee381dc9152f1c1de22c
Depends-On: I3e17c6a2a7f252a9d324a1fea616e22869e55702
Change-Id: I98fd7f76e5d3d096970d6c5f1652e9ee2abeebd6
We no longer need to do this. If you run
"tox -e py38", "tox -e py39", and "tox -e py310",
you will see:
$ ls -l cinder/__pycache__/context*
cinder/__pycache__/context.cpython-310.pyc
cinder/__pycache__/context.cpython-38.pyc
cinder/__pycache__/context.cpython-39.pyc
See PEP-3147 for details on this.
This is different from the older behavior, which
would generate cinder/context.pyc and collide between
different versions of Python. In the versions of
Python that we support, no such collisions happen.
Change-Id: I1262c3ab355dfeabfa57184b6496d7fddd1e8055
Ignore the entire .eggs directory. It contains eggs downloaded by
setuptools to build, test, and run plugins, but more to the point,
it contains a README.TXT that violates D001 (Line too long).
Change-Id: I8f3f4bfb7d720e78d242fbb63d5bf457d8cfb2e2
These are in the cinder doc tree so of course they're block
storage-related.
Change-Id: Ic1950ff89021a89de397619eef17f8100eb3d847
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Use whereto to test that the redirect rules do what we expect. This has
been used in nova-land for years and is helpful as things move around.
Change-Id: I4697c4ce53eb8d67d2f7593085e3eb88f239d1dd
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
The cinder-mypy job is failing because library stubs aren't installed
for requests [0]. Modify the mypywrap.sh to accept options specified
in an environment variable named OS_MYPY_OPTS to the mypy invocation,
and set this var in tox.ini.
The value is "--install-types --non-interactive" which is suitable for
CI purposes, and seems to make sense for local tox use as well [1].
The downside is it basically runs mypy twice, once to determine
whether there are any library stubs missing and then install them, and
againto do the actual check. If we don't want this setting in
tox.ini, we can move it to .zuul.yaml for the cinder-mypy job run.
Also, update the version of mypy in test-requirements to a version
that supports the above options.
And, run mypy in its own env (instead of reusing pep8) so that the
tox logs are preserved during CI runs.
[0] https://zuul.opendev.org/t/openstack/build/b66ee6c21e594940941585b0e9e5082a
[1] https://mypy.readthedocs.io/en/stable/running_mypy.html#library-stubs-not-installed
Change-Id: Id69cb519ee7300b33ff087de4e7d46cdad67d162
For most of our tox jobs we use the usedevelop, which means that tox
will do a pip install -e on our source code on its own.
This means that first it will install deps (which has the constraints)
and then cinder without constraints, since they are defined in deps, and
will pull cinder dependencies ignoring the constraints.
This patch changes how we install dependencies for all tox jobs except
the lower-constraints one, and will make sure that they are always
properly constrained by changing our install_command to include the -c
option.
Change-Id: Ic9a6ac412a334710eb5e45935cd301ca80a5edb9
We're getting divergence between local test runs and the gate based
on what version of pip is being used by tox, which depends on what
version of virtualenv (which specifies the versions of pip,
setuptools, and wheel) that tox uses in your local environment. To
eliminate guesswork, tell tox what version of virtualenv it should
use. Also specify a minversion of tox that can do this.
Change-Id: I01451ec27d3ad6e759636902e497272a89cf6d16
UPPER_CONSTRAINTS_FILE is old name and deprecated
This allows to use upper-constraints file as more
readable way instead of UPPER_CONSTRAINTS_FILE=<lower-constraints file>.
Change-Id: I6fad95580906434feeaf5a51e172ed7045f0e7f4