Commit 55ff751
committed
test_hardware: code formating for multiline construct
The coding style, in test cases of VCPUTopologyTest and
NUMATopologyTest test classes from file test_hardware.py,
is inconsistent. This patch is to reformat these part of
code according to following rules:
- Arrange the `extra_specs` property in a seperate line to allow the
extra_spec with a long name or value.
An example:
some code before reformating:
"flavor": objects.Flavor(vcpus=4, memory_mb=2048,
extra_specs={
"hw:cpu_max_sockets": "5",
"hw:cpu_max_cores": "2",
"hw:cpu_max_threads": "3",
}),
It will be formated as:
"flavor": objects.Flavor(
vcpus=4, memory_mb=2048,
extra_specs={
"hw:cpu_max_sockets": "5",
"hw:cpu_max_cores": "2",
"hw:cpu_max_threads": "3",
}
)
- *Try* to put the closing brace/bracket/parenthesis on multiline
constructs line up under the first character of the line that
starts the multiline construct.
example:
a piece of code in original code
{
"numa_topology": objects.InstanceNUMATopology(
cells=[
objects.InstanceNUMACell(
id=0, cpuset=set([0, 1, 2, 3]), memory=2048,
cpu_topology=objects.VirtCPUTopology(
sockets=1, cores=1, threads=4))]),
"expect": [2, 1, 2]
},
after the reformating, it would be
{
"numa_topology": objects.InstanceNUMATopology(cells=[
objects.InstanceNUMACell(
id=0, cpuset=set([0, 1, 2, 3]), memory=2048,
cpu_topology=objects.VirtCPUTopology(
sockets=1, cores=1, threads=4)),
]),
"expect": [2, 1, 2]
},
- No space or new-line between an empty brace:
change following code
"image": {
}
to
"image": {}
Change-Id: I81f1af98861a7f26d34348473ec245598ff856a8
Signed-off-by: Wang Huaqiang <[email protected]>1 parent 9fc63c7 commit 55ff751
1 file changed
+688
-540
lines changed
0 commit comments