test: fix some pylint errors in test_bind.py

* Use spaces not tabs
* Limit lines to 100 spaces
* Remove an unused import
* Sort imports correctly
* Add a module description

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
This commit is contained in:
Heinrich Schuchardt 2022-04-30 11:26:23 +02:00 committed by Simon Glass
parent 2be964d29f
commit 06d590844f

View file

@ -1,15 +1,16 @@
# SPDX-License-Identifier: GPL-2.0
# Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
import os.path
import pytest
""" Test for bind command """
import re
import pytest
def in_tree(response, name, uclass, drv, depth, last_child):
lines = [x.strip() for x in response.splitlines()]
leaf = ''
if depth != 0:
leaf = ' ' + ' ' * (depth - 1) ;
leaf = ' ' + ' ' * (depth - 1)
if not last_child:
leaf = leaf + r'\|'
else:
@ -108,7 +109,7 @@ def get_next_line(tree, name):
treelines = [x.strip() for x in tree.splitlines() if x.strip()]
child_line = ''
for idx, line in enumerate(treelines):
if ('-- ' + name) in line:
if '-- ' + name in line:
try:
child_line = treelines[idx+1]
except:
@ -131,7 +132,8 @@ def test_bind_unbind_with_uclass(u_boot_console):
child2_index = int(child2_line[0].split()[1])
#bind simple_bus as a child of bind-test-child2
response = u_boot_console.run_command('bind {} {} simple_bus'.format(child2_uclass, child2_index))
response = u_boot_console.run_command(
'bind {} {} simple_bus'.format(child2_uclass, child2_index))
#check that the child is there and its uclass/index pair is right
tree = u_boot_console.run_command('dm tree')
@ -152,7 +154,8 @@ def test_bind_unbind_with_uclass(u_boot_console):
assert child_of_child2_line == ''
#bind simple_bus as a child of bind-test-child2
response = u_boot_console.run_command('bind {} {} simple_bus'.format(child2_uclass, child2_index))
response = u_boot_console.run_command(
'bind {} {} simple_bus'.format(child2_uclass, child2_index))
#check that the child is there and its uclass/index pair is right
tree = u_boot_console.run_command('dm tree')
@ -165,7 +168,8 @@ def test_bind_unbind_with_uclass(u_boot_console):
assert child_of_child2_index == child2_index + 1
#unbind the child and check it has been removed
response = u_boot_console.run_command('unbind {} {} simple_bus'.format(child2_uclass, child2_index))
response = u_boot_console.run_command(
'unbind {} {} simple_bus'.format(child2_uclass, child2_index))
assert response == ''
tree = u_boot_console.run_command('dm tree')
@ -176,7 +180,8 @@ def test_bind_unbind_with_uclass(u_boot_console):
#unbind the child again and check it doesn't change the tree
tree_old = u_boot_console.run_command('dm tree')
response = u_boot_console.run_command('unbind {} {} simple_bus'.format(child2_uclass, child2_index))
response = u_boot_console.run_command(
'unbind {} {} simple_bus'.format(child2_uclass, child2_index))
tree_new = u_boot_console.run_command('dm tree')
assert response == ''