This also adds a check to neutron/hacking/checks.py that should catch this
error in the future.
Blueprint: neutron-python3
Change-Id: Ie7b833ffa173772d39b85ee3ecaddace18e1274f
In Python 3, there is no "basestring". In Python 3, "six.string_types" is
"basestring", and "str" in Python 3.
Change-Id: Ic22e932cbf3c4b75cd424f4b41428da869f197cf
Blueprint: neutron-python3
The function `xrange` was renamed to `range` in Python 3.
* Remove `xrange` occurences so that Python 3 tests can pass. Use
`six.moves.range` instead to get the right function in both cases.
* Generalize the use of the efficient `range` (ex-`xrange`) in
critical sections (when iterating over large lists).
* Simplify code.
* Add a hacking check to prevent future usage of `xrange`.
Change-Id: I080acaaa1d4753619fbbb76dddba6d946d84e73f
Partially implements: blueprint neutron-python3
Removed use of contextlib.nested call from codebase, as it has been
deprecated since Python 2.7.
There are also known issues with contextlib.nested that were addressed
by the native support for multiple "with" variables. For instance, if
the first object is created but the second one throws an exception,
the first object's __exit__ is never called. For more information see
https://docs.python.org/2/library/contextlib.html#contextlib.nested
contextlib.nested is also not compatible with Python 3.
This is the first patch in a series for removing use of
contextlib.nested.
Added hacking check to catch if any new instances are added to
the codebase.
Line continuation markers (e.g. '\') had to be used or syntax
errors were thrown. While using parentheses is the preferred way
for multiple line statements, but in case of long with statements
backslashes are acceptable.
Partial-Bug: 1428424
Change-Id: I171fbdb89892a3d4548bf2ca52f4a7dd9ef8dccb
Oslo project decided to move away from using oslo.* namespace for all their
libraries [1], so we should migrate to new import path.
This patch applies new paths for:
- oslo.config
- oslo.db
- oslo.i18n
- oslo.messaging
- oslo.middleware
- oslo.rootwrap
- oslo.serialization
- oslo.utils
Added hacking check to enforce new import paths for all oslo libraries.
Updated setup.cfg entry points.
We'll cleanup old imports from oslo-incubator modules on demand or
if/when oslo officially deprecates old namespace in one of the next
cycles.
[1]: https://blueprints.launchpad.net/oslo-incubator/+spec/drop-namespace-packages
Depends-On: https://review.openstack.org/#/c/147248/
Depends-On: https://review.openstack.org/#/c/152292/
Depends-On: https://review.openstack.org/#/c/147240/
Closes-Bug: #1409733
Change-Id: If0dce29a0980206ace9866112be529436194d47e
Release notes:
http://git.openstack.org/cgit/openstack-dev/hacking/tag/?id=0.10.0
* Remove references in tox.ini to removed rules.
* Remove custom @author check since it's now implemented in hacking.
* Move N323 to N322 that is freed due to @author check removal.
* Temporarily skip W292 (no newline at the end of file).
* Temporarily skip H238 (old style classes).
Change-Id: I6d990a564df6a312bd09b2a152315bbdba732082
Fix some uses of assertCalledOnceWith, which seems like a mistake of
assert_called_once_with.
Also, add a hacking check to prevent the mistake.
Closes-Bug: #1397184
Change-Id: I12d077e2724d52eff65d55aff1130fbbb69671b1
Don't translate debug level logs and enforce log hints
Our translation policy
(https://wiki.openstack.org/wiki/LoggingStandards#Log_Translation) calls
for not translating debug level logs. This is to help prioritize log
translation. Furthermore translation has a performance overhead, even if
the log isn't used (since neutron doesn't support lazy translation yet).
NOTE: this is done on a directory by directory basis to ensure that we
do not have too many conflicts and rebases.
Add a local hacking rule to enforce this.
This patch set enforces the directory neutron/agents
Partial-bug: #1320867
Change-Id: I4bd562e5138c2d2850072440aa121f27e902463a
mock.assert_called_once() is a no-op that tests nothing. Instead
mock.assert_called_once_with() should be used (or use
assertEqual(1, mock_obj.call_count) if you don't want to check
parameters).
Borrowed HACKING rule from Davanum Srinivas's nova patch to
prevent it from appearing again.
Change-Id: Idac1d3c89c07e13c9a209663f4e557fcb7547821
Closes-Bug: #1365751
Closes-Bug: #1300265
We have git to track authorship, so let's not pad source files
with it as well.
A hacking check has been added for this. The value is N322.
Change-Id: Iab0b64d417e0bb41a6b455e2ac377deee64ec3ee
jsonutils provides multiple benefits in comparison to pure stdlib json
(like using simplejson on Python 2.6).
Similar patch was already merged before [1], but since it lacked hacking
rule to enforce jsonutils usage, new occurrences of stdlib json module
usage were introduced.
This patch switches all the code to using jsonutils and adds a hacking
rule to enforce the rule.
The hacking rule requires that jsonutils module does not mimic as 'json'
thru using import renames, so the code was updated not to rename the
module when doing import.
The hacking rule was shamelessly copied from the corresponding nova
review [2].
[1]: https://review.openstack.org/#/c/99760/
[2]: https://review.openstack.org/111296/
Change-Id: Ie7a5bb76445e15cde9fbf9ff3d2101a014637b37
Update a number of files to add missing translation support.
The patch adds a new hacking check - N320. This ensures that
all log messages, except debug ones, have translations.
A '# noqa' indicates that the validation will not be done on
the specific log message. This should be used in cases where
the translations do not need to be done, for example, the log
message is logging raw data.
Change-Id: I3e1fdd04d87b09dff50950b5e85f5cacfb29afdc
Closes-bug: #1314994
* Point to new location for hacking doc
(http://docs.openstack.org/developer/hacking/)
* Remove openstack-common section because already in main hacking doc
Change-Id: I7fbcfe13469a75fed08700ccbe07fefbee33db22
Reference the OpenStack hacking guide in HACKING.rst and remove
duplicate entries. Adds placeholder section for neutron specific
rules.
Change-Id: I4bfbab50b77e7592178dda44c7f4f52edc7fdc21
Example of Human Alphabetical Order Examples section in HACKING.rst
is wrong, this patch fixes it to the right order.
Closes-Bug: #1213568
Change-Id: Ib7f8baf20c437c3fa776201998c36f33bdde2f78
This change renames everything to Neutron while providing backwards
compatible adjustments for Grizzly configuration files.
implements blueprint: remove-use-of-quantum
Change-Id: Ie7d07ba7c89857e13d4ddc8f0e9b68de020a3d19
There are several common fixtures that every test case wants. Following
the pattern in Nova, add a common base test case class to hold these things.
Change-Id: I2d2cd91e5051d9cbf230e6f48985d6eddcb7b58a
As part of the move towards testr and parallel test running, we
start to use testtools and fixtures to make the test suite
resilient and more pedantic.
Part of blueprint grizzly-testtools
Change-Id: I90250de9fe21237db34f6a50b89b15863e270aa5
Replaced logging with openstack.common.log
Removed imports where logging is not used
Fixes bug #1095541
Change-Id: I5b03d9697dde3ef3520f67d1d8166f7af7689551