We want to make sure that we don't have usage of the old
oslo.concurrency naming slipping in with new changes where
we should be using the oslo_concurrency namespace. This change
adds a hacking check to avoid use of the deprecated namespace.
As we convert more oslo libraries to the new namespace the check
will be updated to enforce use of the new namespace.
This hacking check is based upon the same N333 hacking check
in Cinder.
Change-Id: Ibec6d09e9d313c9e723f7542cedb9da5772d3de2
Mock has a method called assert_called_once_with to check that a mock
was called and the arguments it took were as expected. Mock does not
have a method called assert_called_once and calling it just creates a
mock bound to that name. This means that not only is nothing tested
when assert_called_once is used, the tests also don't warn about this.
This commit attempts to address this in two ways:
- all occurrences of assert_called_once are replaced with a real
assertion.
- the hacking check that nova uses to guard against this has been
copied to cinder's local hacking checks.
Fixing the assert_called_once issues also highlighted other mistakes
in certain tests which were addressed to make the tests pass.
Due to the nature of mock, this issue is also possible if a method is
misspelt or just mistakenly used and so the hacking check is only
addressing one very specific case. That said, it does appear to be a
common mistake and so is worth singling out.
Change-Id: Iedcc3f48d91f7ebd8878ccc3bca3d023503774bd
Closes-Bug: #1394544
We haven't been very good at enforcing putting new hacking checks
into HACKING.rst. This change brings the file up to date.
Change-Id: I95ef533d031d333da5615ead997b54c6506c2c2a
Commit 4dc37abc removes the few instances of LOG.audit that
were in Cinder. Given that the plan is to remove LOG.audit messages
from OpenStack, I am adding this hacking check to ensure that such
messages do not sneak their way back into Cinder.
Unit tests are included with this change.
Change-Id: Icc416a68f958f60260f1c55af0d8605c95913bf1
Commit 3e2b1117 added a check to make sure that the _
function was being explicitly imported so that translation would
work properly.
I have discovered that those regexes/code would not work in some cases.
Particularly if the import line imported multiple things from
gettextutils or i18n. Also the check being used to find lines using
the _ function was not right.
This commit fixes the issues and adds appropriate tests. It also
adds the hacking check to HACKING.rst which should have been done the
first time around.
Change-Id: I7227bb0051836e537bff2f0f97662c06452d5af6
According to the OpenStack translation policy available at
https://wiki.openstack.org/wiki/LoggingStandards debug messages
should not be translated. Like mentioned in several changes in
Nova by garyk this is to help prioritize log translation.
This patch adds a new hacking check - N319 - that ensures all
debug log messages don't have translations.
Change-Id: Id9c2715f25c8f2ea52235aba4bd1583655391584
Implements: blueprint debug-translation-removal
Closes-Bug: #1318713
The current link in the HACKING file is broken. This references the
correct location for contributors to view.
Change-Id: I614f78fdea32025c2c5cf9599c698dde9c81ab21
Reference the OpenStack hacking guide in HACKING.rst and remove
duplicate entries. Add placeholder section for cinder specific rules.
cinder specific rules can be created using hacking's local check
support.
Change-Id: Ia74da70363e3fe602405a440c1d2ec75052e9193
Raising NEW exception is bad practice, because we lose TraceBack.
So all places like:
except SomeException as e:
raise e
should be replaced by
except SomeException:
raise
If we are doing some other actions before reraising we should
store information about exception then do all actions and then
reraise it. This is caused by eventlet bug. It lost information
about exception if it switch threads.
fixes bug 1191730
Change-Id: Ic2be96e9f03d2ca46d060caf6f6f7f713a1d6b82
Sync up with changes made in Nova, this adds information
about line continuation (PEP8), OpenStack capitalization,
and commit messages.
Change-Id: Id6637307411bcc7a3637ac514c4ec34e26481e0d