The default tox cmd should also run the 'functional' target, this got
missed in adding that sub target.
Change-Id: I9a10b0c9798d9f90db03991c45b9f2b285d1e4d0
The max-complexity is now set at 35. We are unable to lower this due to
the following offenders:
./nova/virt/xenapi/vmops.py:431:1: C901 'VMOps._spawn' is too complex (34)
./nova/network/manager.py:1226:1: C901 'NetworkManager._do_create_networks' is too complex (34)
./nova/network/neutronv2/api.py:370:1: C901 'API.allocate_for_instance' is too complex (34)
Change-Id: I6101dcb594b88d346edd72eea2ef2250c4e2891f
If your native locale is not en_US and you run tests, some will fail due
to the message translation that happens since the assertion messages are
in en_US (not translated, just hard-coded in the tests).
I recreated the bug by setting LANGUAGE=en_GB in my tox.ini and tested
against nova.tests.unit.api.openstack.test_wsgi.
Note that setting LANG=en_US had no effect.
Closes-Bug: #1427745
Change-Id: Ib1c71d0d4170ba1a7ed2fe3eaf0e2d8071ec01d6
In I7033847bab82b6d3cd8f2bdb66c553fec93d7acb, we disabled
N333 to allow changes in flight to still mix up oslo_ and
oslo. based imports. We should revert the change and enforce
every review use just the oslo_ version from now on.
Change-Id: I1db83048c569bcdd62538cce9df076fc355f7b26
There's lot of code in flight that will break if we switch
on the asserts to error out pep8/flake8 right now. So
we should temporarily switch it off. Doing this as a separate
review so it's easy to revery and stands out on its own.
Change-Id: I7033847bab82b6d3cd8f2bdb66c553fec93d7acb
Commit a8a87900cf removed
H238 from the flake8 ignore list but missed removing the
comment about why we were ignoring it in the first place.
Change-Id: I1fd89aafeea50bead18c8bf4ffdc7577ded2bde3
- Add missing commas
- Replace single quote with double quote
- events field contains a list of events (event-create-req.json)
- Remove empty files
- Adds a JSON validation test to the docs pipeline
Co-Authored-By: Nicolas Simonds <nic@metacloud.com>
Change-Id: I9a4a9b6b8e2da73b5f25145be3b2faa44ebdb340
Fix H238 failures and enable check for H238
H238 old style class declaration, use new style
(inherit from `object`)
Change-Id: I71dd353ab260a513c5df5af0ee07754e23878570
The _get_guest_config() method of libvirt's driver.py is currently the
worst offender in nova. This patch refactors the method to reduce the
complexity of the method from 40 (originally; it has since been dropped
to 35 by other patches) down to 24. With this change, the highest
complexity method is 37, so we can lower the limit in tox.ini to 38.
Change-Id: I05de301bc3dfd84ed15ce3cbb8a7c50f2d1385ed
This is a refactor designed to reduce the cyclomatic complexity of the
current worst offender in nova: the servers.create() method of the nova
API. The complexity of the method was 46; it is now 22.
No logic changes were made.
This builds on the effort started with Change 129125 by Joe Gordon.
Closes-Bug: 1403586
Change-Id: Ib102091773f786b8c8dc5b79c6d776418ed1d57d
W292 no newline at end of file
W292 started failing with hacking 0.10.0, fix all cases and gate on the
rule.
Change-Id: I6196e8059e71730cc567d4dd211264cdd2272c40
Release notes:
http://git.openstack.org/cgit/openstack-dev/hacking/tag/?id=0.10.0
* Remove references in tox.ini to removed rules
* Fix minor changes (H501)
* Clarify that H306 (imports in alphabetical order shouldn't be skipped)
* Ignore H238: check for old style class declarations
* Temporary skip W292, fix in next patch.
Change-Id: I6d990a564df6a312bd09b2a152315bbdba732082
The pylint tests have been broken for several months and
the Jenkins job has also been disabled. There has been
no sign of attempts to address this, so just delete what
remains of the pylint support so developers don't mistakenly
think it is supposed to work with patches they are submitting.
Change-Id: Ifacc99e45acb0e9a72be6c31113e0cf073354f02
Start extracting all the setup code in note.test into fixtures which
will let us decompose test setup (and have test base classes that
don't setup everything).
This creates new OutputStreamCapture fixture and StandardLogging
fixture and unit tests for both of them plus tests for the exiting
Conf fixture.
H305/306 have to be turned off because hacking import rules are broken
and continue to believe that fixtures is a nova module not the
absolute one.
Change-Id: I97fdacdf5a6ad2957b0efa1e21ae084d4eb04ab9
This moves the integrated tests into the functional tree as an initial
seed for the functional tests. It was agreed to as an early step at
the design summit. Work on cleaning these up will happen after the
move.
PYTHON_HASH_SEED=0 is needed because these tests apparently remain
order dependent.
Also remove the use of test.ReplaceModule, which is an untested
mocking system in the nova tree that doesn't seem to reliably
work. Use stubs instead for the time being, as this will ensure
repeatability of the code.
Part of bp:functional-tests-for-nova
Change-Id: I742c487dd7bca9de3e811c545de477367fff112c
Tox functional job currently will fail because there are no tests,
which is makes it a little hard to atomically turn on voting with the
test move. To trick the system we can make tox functional always pass,
then change the tox definition to the real thing during the sideways
move.
Part of bp:functional-tests-for-nova
Change-Id: Ic276522851fba6d1d95dd1f3bdde1d48935568a3
This patch fixes the pep8 issues of the tool scripts and
configures tox to run pep8 on the tools directory.
Two hacking rules have been modified to ignore the tool directory as both
rules are checking oslo usage which is not critical in case of tools
- N310 use timeutils instead of datetime module
- N324 use jsonutils instead of json module
The tools/xenserver directory is still excluded from pep8 as it contains
scripts that are expected to run on dom0 with python2.4 therefore the
following rules cannot be meaningfully followed
- H231 Python 3.x incompatible 'except x,y:' construct
- H233 Python 3.x incompatible use of print operator
Change-Id: Icfd9e708a2ca1e421676b410e41807b2e630718f
As part of the split of functional and unit tests we need to isolate
the unit tests into a separate directory for having multiple test
targets in a sane way.
Part of bp:functional-tests-for-nova
Change-Id: Id42ba373c1bda6a312b673ab2b489ca56da8c628
Provide a tox -e functional stub, as a place for functional tests to
migrate to. This will allow us to write a zuul test configuration for this
environment.
Part of bp:functional-tests-for-nova
Change-Id: I8a1107beab151f9bf574cfbae1d4dc18400fd74e
Now that we fixed the two worst offenders, drop the mccabe
max-complexity setting in flake8 to 47.
Add note explaining how to generate a list of functions that are too
'complex'.
Change-Id: I44000e9e95c457ae9000c428460b5825d8ad3f92
Let's switch to the newly released oslo library for the
processutils and lockutils. We use the config fixture(s) to
specify disable_process_locking and lock_path in the CONF
variable of oslo.concurrency library for correctly setting the
flags.
The previous attempt at updating nova to use oslo.concurrency
was reverted as it stopped running any tests. lockutils-wrapper
should have been used in ini/shell scripts
instead of lockutils.py module as the the module is
no longer runnable (__main__ has been removed). In this
review we use lockutils-wrapper correctly. The test harness
has since been updated to bail out if 0 tests are run as
well for additional insurance.
Change-Id: I14c75ef2196fd08c9465d648e5cd53777bd9c7d1
Co-Authored-By: Nikola Dipanov <ndipanov@redhat.com>
Co-Authored-By: Corey Wright <corey.wright@rackspace.com>
This patch made unit tests stop running (always runs 0 unit tests) we
should revert and put a check in place to prevent that from happening
so that we don't regress the rest of Nova trying to figure out the
oslo.concurrency issue.
This reverts commit 382294762b.
Change-Id: I98b04ac2a0ba67ba8af44867799317fdf95b8aff
Now that we have stopped running python26 jobs in the gate, remove
python26 from the list of jobs in tox
project-config patch: Ib495467e00e4b6abf2b3c2b9445b51652ba25167
Change-Id: I18262e91c9f5fc2381c6f5b37eb45b5f27aa81db
flake8 has support for cyclomatic complexity (Mccabe) currently our
worst offender has a complexity of 67 (25 is considered very bad). So
set our max-complexity to 68 so we at least don't make things any worse.
This is the first step in bringing this number down to 25 or so.
https://github.com/flintwork/mccabe
Change-Id: I5117ca58ad28888e24c16251aa5e92084ead97ca
In order to get similar behavior to the way testr out of the box
works, only displaying failing results, all the user to define
TRACE_FAILONLY environment variable (any value will do). After this
point only failures, and things leaking out of stderr will end up on
the screen.
We also need to remove the suppression of the inline fail dumps for
this to have the impact that you'd expect.
Change-Id: I72911adc8a03450522429c52db661ec0a1bc4678
Found an interesting cantrip in the devstack tox.ini that gets rid of
the scary can't find bash error message at the beginning of test
runs. Reducing non error looking error things make it easier to see
real errors.
Change-Id: I4e1b826626063bf8d5a15531f5768f9ce0eea6a5
It's apparent that Nova is quite a ways from Py3K support, and
developers are not expected to run the py33 tox env. Rather than add
more envs for later Python interpreter versions which will be
equally broken, just remove it for now.
Change-Id: I885e6e8899f771cc52a2bf6282fd7bc1ed3083aa
Tempest developed a set of wrappers around testr to print out tests as
they are running through using the subunit stream. This also displays
which workers the various tests are running on. Adapted for nova's
need for loading the locking.
I expect that the needs of nova will diverge this over time,
especially what's displayed during tracing, as such I think it's fine
to just do a transplant and not try to turn this into some external
repo.
Change-Id: Ied1708515fc49f4e18cd8dbb7b2cd821f85e1966
Bring over the cleaning line from run_tests.sh for the pyc files to
all the tox runs.
This should eliminate the need to clean -x -i to kill pyc files in
your local directory to get tests to pass.
Closes-Bug: #1368661
Change-Id: Idf3a46d8c95806f2d2ce28ce84ced12b625e53df
This commit removes the regex to exclude the coverage extension from
the tox coverage job. The regex was needed for the unit tests on the
coverage extension, (which would mock out coverage) however that
extension has since been removed from nova. So we no longer need to
exclude tests that don't exist anymore.
Change-Id: I45685b1113ecc78eda92f13755ff2274ff517829
Invoke the pip-missing-reqs tool to find packages used by nova but
not explicitly included in its requirements.txt file.
Add simplejson to the requirements to fix the failing check.
Change-Id: Ia90416c613c0acea04f3d4ab4898f550cb702a49
New tox (>=1.7.0) sets a random python hash seed by default. This is
generally good for testing because it will help keep projects working
regardless of the hash seed, but nova unittests don't currently pass
with a random hash seed so set it to the python default seed.
This change will allow us to use new tox again and remove the
restriction on tox<=1.6.1 to run unittests.
Redundant setenvs for specific test envs are removed to prevent them
from overriding the PYTHONHASHSEED value.
Note this change will need to be backported to the stable branches to
keep unittests there working with new tox as well.
Change-Id: Ib54364877a251db48c54dfdc43c503281ea1f04a
We can install libvirt-python bindings from pypi now because the libvirt
devs are supporting pypi packages and the version of libvirt we are
testing nova master against is new enough to link against that pypi
package.
Making this switch will better isolate nova test environments as all
dependencies can be installed without any site packages leaking into
virtualenvs. It will also make the dependency on libvirt-python a bit
more explicit.
Change-Id: I2890702869f05a02ad5e2ecb419db06433231b36
pep8 E265 makes sure block comment start with '# '. Fix and gate on this
new rule as it helps improve comment readability.
In the few cases where the comment was just commented out code, remove
the comment.
Change-Id: Iea1c445df8ddc2b6c17a4ab697ad756eef2f91fa
I6c2537dd27c947e36ebf37eb3b5c8a1ab8b026a1 mistakenly removed H803 since
running flake8 had no hits for this test, but H803 is the period in the
commit message which we are explicitly ignoring until the next version
of hacking is released (which will remove this check).
Change-Id: I22860cc61336ef5bf8ce4509fe130160bdf7e45b
rename instances of loop variables to prevent them from shadowing
imports. This strict check was added in hacking 0.9
Change-Id: Ib5e162b85e3c6931f213731c3febd3dd8ba0b4b1
Fix the offending instances of the rule
and removes it from the ignore list in tox.ini
so that we can gate on E711 and E712 rules.
Most violations were in DB queries. Replace as follows:
False -> sqlalchemy.sql.false()
None -> sqlalchemy.sql.null()
True -> sqlalchemy.sql.true()
Change-Id: Id84aa04697d1b3c23dc03195113e296c6715379d
oslo.i18n provides the i18n functions that were provided by
oslo-incubator's gettextutils module. Some tests that were
using internal details of the library were removed.
Change-Id: I44cfd5552e0dd86af21073419d31622f5fdb28e0
Remove H803 as Nova does not run into that issue. Sort
the rest of the items (E129 was out of place).
Change-Id: I6c2537dd27c947e36ebf37eb3b5c8a1ab8b026a1