tools: add tool for pep8 reformatting

This calls the PEP8 linter called autopep8:

https://github.com/hhatto/autopep8

So we can make autotest to fully adhere to PEP8,
since there's a tool that can enforce the standard.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
Signed-off-by: yangdongsheng <yangds.fnst@cn.fujitsu.com>
tools: add pep8 check into check_patch

Integrate the PEP8 linter into the virt-test full
tree and patch verification process. It works by
verifying whether the PEP8 linter modified the file in
place, if it did, it means there are non compliances
in the code.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
Signed-off-by: yangdongsheng <yangds.fnst@cn.fujitsu.com>
tools: Add codespell

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
tools/check_patch.py: Add codespell check

Integrate codespell to our own check_patch.py script.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
run_pep8 refactor

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
Mass spelling fixes

Using the program codespell

https://github.com/lucasdemarchi/codespell

We found a number of spelling mistakes, that could be
found and fixed. The result of the automated script
was double checked, of course.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
tools/run_pep8.py: Ignoring E501,W601
PEP8 mass fixes

With the help of the PEP8 script, a semi-automated clean
of the code base was made, and effectively changing some
of the coding style rules of our code base:

 * No more 2 lines spacing among functions
 * No more combined module imports

In the end, it was going to be too difficult to take
into consideration E501 (line length > 80) errors and
W601 (.has_key() is deprecated), so these were ignored,
at least for now.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
tools/check_patch.py: Fix incorrect logic

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
virttest.utils_misc: Convert host_setup_flag into int

If host_setup_flag is set up in cfg files. Convert it to int in this
step. This can ignore the type error when use it for bit check.

Signed-off-by: Yiqiao Pu <ypu@redhat.com>
virttest.libvirt_storage_unittest: remove ModuleLoadCheckVirsh class.

Since we initialize a bogus_virsh in setup to provide a fake virsh for unittest,
then there is no need to skip if virsh command is not available.

Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
Merge pull request #833 from yangdongsheng/libvirt_storage_unittest

virttest.libvirt_storage_unittest: remove ModuleLoadCheckVirsh class.
virt-libvirt: Error message enhancement

It's possible to install libvirt bits w/o installing kvm or xen.  This
will be reflected in 'virsh capabilities' output, but the VM class just
reports a key error.  Added two specific error logging messages to make
the problem clearer, but continue to raise the original exception.

Signed-off-by: Chris Evich <cevich@redhat.com>
tool-pep8: update the comment in run_pep8 module.

Options of run_pep8 tool is changed, then the description
should be updated at the same time.

Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
Mass docstring fix

Make virt-test to have a docstring style mostly compliant with
the sphinx's [1] format, reStructured text. This means that
we have to trade all '@' tags to be ':', mostly.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
tools/run_pep8: Add own logging config class

This way we can keep those scripts in sync among
virt-test and autotest.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
Add CODING_STYLE document

This file is also borrowed from autotest, and already
reflects the updates to the coding style of the projects
under the autotest umbrella.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
More docstring fixes

Fix some extra problems with docstrings in the code tree.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
Merge pull request #832 from ypu/host_setup_flag

virttest.utils_misc: Convert host_setup_flag into int
qemu.test: fix module reload failed issue

Signed-off-by: Xu Tian <xutian@redhat.com>