21 Commits

Author SHA1 Message Date
junboli
ca712cb0bd Fix the duplicate hacking check M312 and H203
The hacking "[H203] Use assertIs(Not)None to check for None" is already enabled
in tox. But the local hacking M312 is also avaliable, there is no need to check
twice here for the same check.

Change-Id: I56e19c6dd8905e439247c3b142e74913b5d0d7a6
Closes-Bug: #1710426
2017-08-13 08:01:42 +08:00
chenxing
082159cc54 Update the documentation link for doc migration
Change-Id: I0b4e59c9e2ad0375cdb6aae5369a7b43978c3d69
2017-07-14 07:27:16 +00:00
Tom Barron
0a3df6f99e Hacking: do not translate log messages
Log messages are no longer being translated.

See:
http://lists.openstack.org/pipermail/openstack-i18n/2016-November/002574.htmli
http://lists.openstack.org/pipermail/openstack-dev/2017-March/113365.html

Change-Id: I422fa934b27da1c252f72ac3bf94ef468f0d7ef6
2017-04-09 11:07:09 -04:00
Tom Barron
66a6505d79 remove hacking rule that enforces log translation
Log translation is no longer being done [1] [2] so there
is no point in enforcing it going forwards.

Remove the hacking enforcement so that new commits need
not include this unused feature and so that we can remove
this unused il8n markup in existing code.

[1] http://lists.openstack.org/pipermail/openstack-dev/2017-March/thread.html#113365
[2] https://review.openstack.org/#/c/446762/

Change-Id: I31f35b0597e161a1654467f5a0a2348789292d83
2017-03-17 05:54:03 -04:00
Danny Al-Gaaf
a8ec3317be doc: verify all rst files
Make use of doc8 to verify all rst files which are not
autogenerated for errors and fail if there are any issues
found. The doc8 checks are now part of the tox 'docs'
environment and ran automatically. Checks can also be called
direcly via 'tox -e docs'.

Fix all issues found by doc8.

Closes-Bug: #1664841

Change-Id: I9215524d35646de7485504e4c5ff86fd91a1d09f
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
2017-02-15 07:07:42 +01:00
Ha Van Tu
8407f72c2c [hacking] Ensure not to use LOG.warn
This patchs ensures not to use LOG.warn because LOG.warn deprecated
in Python 3 [1], use LOG.warning instead.

[1] https://docs.python.org/3/library/logging.html#logging.warning

TrivialFix

Change-Id: I50e44a89092e0ee15f5be294837a87c321427921
2016-11-30 06:36:51 +00:00
Tom Barron
f2ffae1870 hacking: Use uuidutils to generate UUID
Added hacking check to ensure that UUIDs are not generated
by uuid4() since we should do this using oslo_utils.uuidutils.

Based on this nova change [1].

[1] I73ee63fbd4f451d3aa5dc1a2a734d68c308b4440

Change-Id: Ic7783c29fbd838c827ccc8ee44aa757fef8e9169
2016-11-16 16:06:40 -05:00
Tom Barron
467321bceb Do not supply logging arguments as tuple.
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
2016-06-09 17:22:36 -04:00
Tom Barron
528ee090bf Hacking check for str in exception breaks in py34
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
2016-05-25 10:23:05 -04:00
Tom Barron
2b7a755af4 Add hacking rule for assertEqual(None, *)
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
2016-05-24 21:13:53 +00:00
Tom Barron
b85248bce6 Use assertTrue rather than assertEqual(True, ...)
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
2016-05-23 19:07:54 -04:00
Thomas Bechtold
06cc17befb Remove openstack-common.conf
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
2016-04-05 09:07:49 +02:00
Tin Lam
bcb0f3133f Add hacking check to ensure not to use xrange()
Added hacking check to ensure not to use xrange for python3
compatibility.

Change-Id: I1aa510660a25936dbf1b2fc5971e7571090a42d0
Closes-Bug: #1538118
2016-03-17 18:02:44 +00:00
houming-wang
51069d5390 Performance: leverage dict comprehension in PEP-0274
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
2015-12-11 19:24:56 -05:00
houming-wang
5bd39bad8b Fix wrong check message
From the hacking guidelines, the numbers should be M3xx. N333
should be M333. Fix it.

Change-Id: I67b8d0e15fa6c68ab59774864165941051ab8649
Closes-Bug: #1524808
2015-12-10 08:31:24 -05:00
Andreas Jaeger
15641fba88 Convert files to use _LE and friends
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
2014-10-31 09:47:59 +01:00
Andreas Jaeger
f039a76868 Add manila specific hacking checks
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
2014-10-21 09:34:59 +02:00
Christian Berendt
025f68504a Remove extraneous vim editor configuration comments
Change-Id: I3cecf4e2a0f00e14e144124512ce8f7b8928d7f8
Partial-Bug: #1229324
2014-10-08 22:40:24 +02:00
vponomaryov
16a04df3d0 Refactor test framework
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
2014-07-22 14:58:48 +03:00
Yulia Portnova
9169fc311e docs 2013-09-17 10:57:47 +03:00
Ben Swartzlander
f99ef92c90 Initialize from cinder 2013-08-08 10:34:06 -04:00