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: I0321ceed864ccdb8fb78d6fb119b09640bb97896
hacking 3.0.x is really old. Let's bump it to the latest version
available.
This also fixes some errors detected but some rules are excluded now.
See the comments in tox.ini for further details.
Change-Id: I2565e5f5e791dfdd9bbc1890b35c413965d83626
tox4 even when running specific env with -e option tries
to find python version for all envs defined in envlist[1]
when running with --skip-missing-interpreters=false and
fails if interpreter missing for any of the env.
With py38 in envlist it tries to find python3.8
which is not available in ubuntu-jammy by default
and fails, hence use generic version instead i.e py3
to handle it.
Even though [1] is fixed we are still seeing this failure.
[1] https://github.com/tox-dev/tox/issues/2811
Also updated basepython to use TOX_PYTHON if set.
Change-Id: I18765db9682fced05e8441a1e2122f9f814cd31b
When 'tox -e pep8' was run it didn't run any pylint
checks, let's start doing it.
Fixed issues pylint found, 2.6.0 added two new checkers
[1] that make pep8 validation fail:
- raise-missing-from (W0707)
- super-with-arguments (R1725)
[1] http://pylint.pycqa.org/en/latest/technical_reference/features.html
Change-Id: Ib83f30696269c968f41f9c1131596268a4412658
pycodestyle 2.6.0 has some new errors, fix them.
Also bumped minimum hacking to 3.0.1 so it pulls in
the correct flake8, etc, libraries.
Added basepython directive in tox.ini since local
'tox -e pep8' runs were using python2 otherwise.
Change-Id: I3a9f7c2df5b68a3bad036121c9b10b1c184d261c
In hacking 2.0, local-check-factory was removed as it is not compatible
with flake8 3.x and it is advised to use flake8's local plugins [1].
Checks specific to neutron-lib registered via local-check-factory are
converted into flake8's local plugins [2].
Note that neutron_lib.hacking.checks.factory is kept not to break hacking
checks in neutron-lib consumers. They need to be converted into the style
in hacking 2.x in each repository and then we can drop the factory here.
[1] https://docs.openstack.org/releasenotes/hacking/unreleased.html#relnotes-2-0-0
[2] https://flake8.pycqa.org/en/3.7.0/user/configuration.html#using-local-plugins
Change-Id: I90419fe0b385e7bee216a52c1169aba6d6975d56
This change removes the requirement for python 2 and removes testing for
it, but tries to leave the code compatible with python2 where possible.
Co-Authored-By: Nate Johnston <nate.johnston@redhat.com>
Change-Id: I711ae939b5eaa1816af15b22527c38858507127f
Added enforcement of H106, H203, H204 and H205 extensions to
match neutron repo, fixing a few failures in the process.
Also updated to support hacking 1.1.0, bringing in flake8
2.6.2 and pycodestyle 2.4.0 in the process. This ensures
future python3 compatibility and a bit better code styling.
Change-Id: Ibd9cff863eaff940755ccb9c20f39e29e2001cde
This goal is to implement the process set out in the 2018-10-24 Python
Update Process TC resolution[1], for the Train cycle to ensure unit
testing is in place for all of the Tested Runtimes for Train[2].
In practice, this generally means adding unit tests for Python 3.7 and
dropping unit tests for Python 3.5. Using the Zuul template for Train
will ensure that all projects that support Python3 will be tested
against the agreed runtime versions, and make it easier to update them
in future.
Specifically this patch:
- Uses the openstack-python3-train-jobs zuul template rather than
templates for python 36/37.
- Adds Python 3.7 to the setup.cfg classifier.
- Adds py37 to the envlist of tox.ini.
[1]https://governance.openstack.org/tc/resolutions/20181024-python-update-process.html
[2]https://governance.openstack.org/tc/reference/runtimes/train.html
Change-Id: I92e07412e06d5e0bcd4a3ef63643d140243f8205
Depends-On: https://review.opendev.org/#/c/641878/
After latest changes on tox.ini, the minimum
version of tox need to be changed to 2.3.2.
https://bugs.launchpad.net/neutron/+bug/1695888
Change-Id: I006274862f9d66af86db47f29f3b5bf7ac3fc103
As shown in the history of this patch, along with the work in [1], we've
discussed rehoming neutron.common.rpc into lib a number of times before.
One of the main reasons we've decided not to rehome in the past is that
we'd hoped the neutron.common.rcp.BackingOffClient and related plumbing
could be put into oslo.messaging. However, it's 2 years later and that
still hasn't happened [2][3].
This patch proposes we just move forward with the rehome so that we can
begin to untangle the consumers [4]. There's no reason we can't
reiterate on this code in lib; it's no more difficult than in neutron.
This patch includes rehoming of:
- neutron.common.rpc, the only difference in the lib version is that
we dynamically add all neutron_lib.exceptions by default (_DFT_EXMODS).
- neutron.common.exceptions, but exceptions are broken out into their
respective exception modules rather than lumping all together in a
generic single module.
- The fake notifier and RPC fixture, without any real changes.
- A new runtime util method to dynamically load all modules for a
package.
For a sample neutron consumption patch see [5] that was tested with
PS10 herein.
[1] https://review.openstack.org/#/q/project:openstack/neutron-lib+message:rpc
[2] https://review.openstack.org/#/c/407722/
[3] https://bugs.launchpad.net/oslo.messaging/+bug/1667445
[4] http://codesearch.openstack.org/?q=from%20neutron.common%20import%20rpc
[5] https://review.openstack.org/#/c/579989/
Change-Id: I0052ba65973a993e088943056879bc6e982bd0b5
Neutron uses bandit to detect security issues. This patch adds
bandit to the pep8 gate to automatically lint for security issues
in neutron-lib.
Fixed two B101 errors it spotted.
Change-Id: I39d713d0d230b5ae759daa6bc1be9794e6fe2a32
We want to default to running all tox environments under python 3, so
set the basepython value in each environment.
We do not want to specify a minor version number, because we do not
want to have to update the file every time we upgrade python.
We do not want to set the override once in testenv, because that
breaks the more specific versions used in default environments like
py35 and py36.
Change-Id: I922ca42cb37a72be1bfe0765c17b075d6e08e1fa
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
According to Openstack summit session [1] stestr is
maintained project to which all Openstack projects
should migrate.
Let's switch it then.
[1] https://etherpad.openstack.org/p/YVR-python-pti
Change-Id: I430dc5268fb9ef8fcd6e1009f50fb64e32089c37
This patch addresses the following issues in prep for the neutron-lib
1.14.0 release:
- Updates the tox linkcheck target to get it working.
- Removes the glob for modules/* in doc/source/reference/index.rst as
this causes local build errors when not finding anything with the glob.
- Fixes any issues found by running the linkcheck tox target.
Change-Id: I0e96068cd7b6733adc35503b40500b80692cfd6d
Create a tox environment for running the unit tests against the lower
bounds of the dependencies.
Create a lower-constraints.txt to be used to enforce the lower bounds
in those tests.
Add openstack-tox-lower-constraints job to the zuul configuration.
See http://lists.openstack.org/pipermail/openstack-dev/2018-March/128352.html
for more details.
Change-Id: I296a3efad5ec71a3520f79100082b947719108e8
Depends-On: https://review.openstack.org/555034
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
This repo does not need tools/tox_install.sh at all, instead call pip
install directly and add constraints to dependencies.
Change-Id: Id6b1afde54d3dc26c1e95e85ec7e6a7100ff671b
The current linkcheck tox target fails on a fresh neutron-lib clone
due to the /modules not existing under doc/source/reference. This patch
fixes the issue by ensuring the modules are generated before running
the linkcheck target.
Change-Id: Ie55b855c9469435b6f8ef4b3459c3082860f93c0
This patch adds a linkcheck target to our tox.ini that validates URLs
in both our doc and api-ref html. In addition the release checklist is
updated to suggest this should be done prior to releasing.
Partial-Bug: #1716005
Change-Id: I48b4dde3ffd1902a31bf6f352b7143d4c15f3443
The command to build docs is updated to match that run in the gate.
The previous command is to ensure no warning, but sphinx 1.5 or later
has warning-is-error option and there is no need to run a different
command in tox docs target.
Change-Id: Ieac8afd096a158aff6403326104ced31adcb77e1
According to [1], we can passing a "-t" argument to
oslo_debug_helper to indicate the directory where tests
are located. This will solves ImportError exception.
[1] https://docs.openstack.org/developer/oslotest/features.html
Change-Id: Ifb290b00e79f9d5236d84163c13571dc74cea4e0
Closes-Bug: #1666560
The gating on python 3.4 is restricted to <= Mitaka. This is due to
the change from Ubuntu Trusty to Xenial, where only python3.5 is
available. There is no need to continue to keep these settings.
Change-Id: I9701f7ac1551dc60f0f75f64a322a6841108dfe2
Neutron recently updated their usage of hacking to use
version 0.12 [1] that now contains the hacking check
check_delayed_string_interpolation who's off_by_default
value is initially True (i.e. disabled). This hacking check
is defined in neutron_lib, but hasn't been registered in our
factory and isn't being consumed directly [2].
This patch takes a simple approach to reusing openstack-dev
hacking checks:
- Removes all traces of neutron-lib's version of the check; no one is
using it [2].
- Bumps our version of hacking to use 0.12 so we can use the checks
in that release.
- Enables the check via enabled extensions in tox.ini as neutron did [1].
- Updates our hacking check usage, noting that adopters should
enable the same extensions we do (via tox.ini).
[1] https://review.openstack.org/#/c/394817/
[2] http://codesearch.openstack.org/?q=check_delayed_string_interpolation&i=nope&files=&repos=
Change-Id: Ie9448317855b9cba6092cd0f63b77d26a562a5c9
It should be ok to use zuul-cloner these days. [1]
This would avoid docutils 0.13.1, which seems to cause the following
TypeError.
Exception occurred:
File "/home/jenkins/workspace/gate-neutron-lib-api-ref/.tox/api-ref/local/lib/python2.7/site-packages/docutils/writers/html4css1/__init__.py", line 288, in write_colspecs
width += node['colwidth']
TypeError: unsupported operand type(s) for +=: 'int' and 'str'
[1] I8f45a53429b9fcbf3689a268f096afdf5f32f461
Closes-Bug: #1649079
Change-Id: Id75e88f5031aeab21b2158c721881bf2da4a0d28
Neutron-lib adopters should be using neutron-lib's hacking
checks (factory) to validate compliance, but are susceptible
to breakage when new checks are released in neutron-lib (see
partial bug). What we need is a way to roll-out adopter hacking
checks in a controlled manner, giving consumers the opportunity
and tools to comply with new checks.
This patch begins to address this need by:
- Separating neutron-lib hacking checks into 3 separate factories;
adopter, incubating and neutron-lib internal (private).
- Moving any existing checks into their respective factory.
- Updating the usage docs on how to adopt our hacking checks.
- Trusty ole unit test; for obvious reasons.
This patch plays a part in a longer term hacking check strategy:
- Adopters must run neutron-lib's hacking check factory() or its
equivalent via their pep8 checks. This is part of their pep8 gate job
once they update their tox.ini to use neutron's factory().
- Adopters must run a non-voting neutron-lib-pep8-incubating gate job
that runs pep8 with neutron-lib's incubating_factory(). This is means
to warn adopters of upcoming checks without failing their gates.
This job will be created (by me) assuming reviewers agree to this approach.
- We'll communicate hacking checks via the standard means (see usage
docs herein).
Closure of Bug #1609478 will follow completion of the strategy above.
Partial-Bug: #1609478
Change-Id: I5b8d5c41f1bf463109baf9c26ae9d9db5719097d
Release notes for neutron-lib are meant to address neutron
developers and help them identify changes from one release
to another.
Change-Id: I51d2049643d3b35484d07f2f4aad7765f6dac958