Logging format arguments are not supposed to be tuples, but
are rather to be supplied separately - i.e., use
LOG.debug('%s is %s', arg1, arg2)
instead of
LOG.debug('%s is %s', (arg1, arg2))
Rid the manila codebase of this logging format error and
add a hacking check for this. The hacking check will not
catch all corner cases but should help prevent this error
in most cases.
Change-Id: Ibea39f1f90c0444eae5cfcd6090b2a00d84ab923
Closes-Bug: #1585394
So change [1] skips this check in python34 tests.
Replace CheckForStrExc with CheckForStrUnicodeEx
and quit skipping unit test for this hacking check.
Partially-Implements: bp py3-compatibility
[1] Id3d196d6006e7b2e5e56343bd7ba207c5196b61d
Change-Id: I9fdd035a61715039b737bf65df5c5636e8a55f54
Several bugs have been raised and fixed to convert
assertEqual(None, *) with assertIsNone in tests.
Install a hacking rule to prevent new occurrences of
this problem.
Change-Id: Ib157f911e2f6a90d21c3886b3139f9b109962052
Manila unit tests contain several occurences of
assertEqual(True, ...) instead of assertTrue(...).
Fix these occurences and add hacking check so new
occurences don't creep into the codebase.
Closes-Bug: #1584948
Change-Id: Ib586590b9efcb5253e8c09ee735a8ffb62b44d74
Oslo Incubator in no longer maintained and Manila doesn't use it
anymore. So remove the config file and also the documentaion about
it.
Change-Id: Ib15870b0292b2b78bcfc97ffee570e77226ec25b
PEP-0274 introduced dict comprehensions to replace dict constructor
with a sequence of length-2 sequences, these are benefits copied
from [1]:
The dictionary constructor approach has two distinct disadvantages
from the proposed syntax though. First, it isn't as legible as a
dict comprehension. Second, it forces the programmer to create an
in-core list object first, which could be expensive.
Manila does not support python 2.6, we can leverage this.
There is deep dive about PEP-0274[2] and basic tests about
performance[3].
Note: This commit doesn't handle dict constructor with kwagrs.
This commit also adds a hacking rule.
[1]http://legacy.python.org/dev/peps/pep-0274/
[2]http://doughellmann.com/2012/11/12/the-performance-impact-of-using
-dict-instead-of-in-cpython-2-7-2.html
[3]http://paste.openstack.org/show/480757/
Change-Id: I87d26a46ef0d494f92afb1d3bebda2797a12413c
Closes-Bug: #1524771
From the hacking guidelines, the numbers should be M3xx. N333
should be M333. Fix it.
Change-Id: I67b8d0e15fa6c68ab59774864165941051ab8649
Closes-Bug: #1524808
LOG.warn etc. should be translated separately and thus messages need to
be marked with _LW for LOG.warn, _LI for LOG.info and _LE for LOG.errors
and LOG.exception.
Mark all LOG invocations with proper translation marker.
Use ',' instead of '%' when adding variables to log messages to allow
lazy evaluation.
Add new hacking checks for these.
Change-Id: I31d3ee50f30c63d7d647b1c2b1eae50bf96f0c74
Add manila specific hacking checks (copied over from nova) to test:
- [M319] Validate that debug level logs are not translated.
- [M323] Ensure that the _() function is explicitly imported to ensure
proper translations.
- [M325] str() cannot be used on an exception. Remove use or use
six.text_type()
- [M326] Translated messages cannot be concatenated. String should be
included in translated message.
Also include some tests for the above (copied from nova and adjusted).
Rework HACKING.rst to remove the content that is in the global hacking
file and add in the manila specific rules.
Change-Id: I530609a183c81ba942623b73d5f62cd338b04211
Manila's test framework is pretty old and requires update.
Changes:
- usage of nose replaced with testr
- now all the tests are thread safe
- added new options for run_tests.sh, such as --concurrency, --debug, etc...
- new '--concurrency' option for run_tests.sh defaults to 1, examples:
./run_tests.sh # will run in 1 thread
./run_tests.sh --concurrency 2 # will run tests in 2 threads
- added tools/colorizer.py for colorizing output of testrun with run_tests.sh
- tests running with tox use as much threads as cores available by default
- examples of testrun with tox:
tox # will run test suites defined with 'envlist' in tox.ini, now it is pep8,py26,py27
tox -epy27 # amount of threads is equal to amount of cores
tox -epy27 -- --concurrency=2 # amount of threads is 2
tox -epy27 -- --concurrency=4 # amount of threads is 4
- Added 'Database' class to manila.test module, for more conveniant db testing
- updated policy file 'manila/tests/policy.json' to allow share-network actions
- removed nose-related requirements
- added new requirements for testrepository, subunit
With merge of this change all old installed virtual environments become
incompatible and should be removed with "rm -rf .tox .venv" before testrun.
Implements blueprint testr-with-unittests
Change-Id: I9579ecd538e29d478dbc12adc7dcc33fc668b397