Move LockFixture into a fixtures module

In Nova and other projects, fixtures are in test-requirements.txt and
NOT in requirements.txt so updating nova to use latest lockutils.py
is not possible. So let us move LockFixture out into it a separate
fixtures.py module where in theory we can add other fixtures as
well. See https://review.openstack.org/#/c/52153/ for an attempt to
try latest lockutils.py in Nova.

Change-Id: I12942d6390d06bb889d4145e708692fa886d99b5
Merge "Move LockFixture into a fixtures module"
Replace assertEquals with assertEqual

The method assertEquals has been deprecated since python 2.7.
http://docs.python.org/2/library/unittest.html#deprecated-aliases

Also in Python 3, a deprecated warning is raised when using assertEquals.

Change-Id: I667e41df786c842ecffc6920b80319fd8b3487a3
Merge "Replace assertEquals with assertEqual"
Correct execute() to check 0 in check_exit_code

This patch fixes: if a process exits with returncode 0, the function
always returns without raising an exception, regardless of whether
its check_exit_code includes 0 or not.

Change-Id: Ibdf7599dd91949153629083e4c5a47d263d6d002
Allow lockutils to get lock_path conf from envvar

This would allow us to provide a common dir for all locks in all
processes involved in testing or running software.

Change-Id: I64fccddc92ada67a3df6daf86d73750a41bbce05
Add main() to lockutils that creates temp dir for locks

This change would allow us to create one directory to store all locks
from all processes involved in testing in projects.

Here are examples on how to use this:
Heat - https://review.openstack.org/47360
Ceilometer - https://review.openstack.org/44809
(see tox.ini)

Change-Id: I9e1260e202b7d8feb9c762a879b9804ed85ccbd6
Merge "Correct execute() to check 0 in check_exit_code"
Merge "Allow lockutils to get lock_path conf from envvar"
Merge "Add main() to lockutils that creates temp dir for locks"
fix lockutils.lock() to make it thread-safe

lockutils.lock() is currenctly safe when used with greenthreads, but it is not
safe when used with classic threads. This change uses a lock to protect
_semaphores dictionary.

Change-Id: Ia18e6e9f9a1353640729ac57d7225c660159cd55
Closes-Bug: 1065529
Adjust import order according to PEP8 imports rule

This patch just adjust import order to follow PEP8 imports rule.
See http://www.python.org/dev/peps/pep-0008/#imports
Imports should be grouped in the following order:

    standard library imports
    related third party imports
    local application/library specific imports

Change-Id: I6d92e9eda72d83cbf940b7699268f884bd4045c1
Use six.text_type instead of unicode function in tests

This patch replaces unicode function with six.text_type in tests.
Let test code don't break in Python3 environment.
See http://pythonhosted.org/six/#six.text_type

Change-Id: I27e0db2034da7898f713719cc81f1b6c1f1fdeea
Merge "Adjust import order according to PEP8 imports rule"
Merge "fix lockutils.lock() to make it thread-safe"
Merge "Use six.text_type instead of unicode function in tests"
Remove vim header

No need to set tabstop 189 times, this can be set in your vimrc file
instead.  Also if set incorrectly gate (pep8 check) will catch your
mistakes.

Change-Id: Ic6f0c0ef94e8194a5c121598305d1ec3c74e4843
Unify different names between Python2/3 with six.moves

Some modules use different names in Python2 and Python3. Use six.moves
to make them work well in Python2 and Python3.
This is changes mapping:

six.moves      Python 2                 Python 3
builtins        __builtin__ 	        builtins
filter 	       itertools.ifilter() 	filter()
reduce 	       reduce() 	        functools.reduce()
reload_module  reload() 	        imp.reload()

Implements: blueprint make-python3-compatible
Change-Id: I97971f2ab40385bfc2c73ae7e8a7620c4d64a03c
Merge "Unify different names between Python2/3 with six.moves"
Trivial: Make vertical white space after license header consistent

Vertical white space between license header and the actual code is not consistent
across files. It looks like majority of the files leaves a single blank line
after license header. So make it consistent except for those exceptional cases
where the actual code starts with a function or class definition.

Change-Id: If6679ab19dc2d7a9df93e076db3019abc1e5b86b