mirror of
https://github.com/u-boot/u-boot.git
synced 2025-04-22 20:58:22 +00:00
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:
parent
2be964d29f
commit
06d590844f
1 changed files with 148 additions and 143 deletions
|
@ -1,15 +1,16 @@
|
||||||
# SPDX-License-Identifier: GPL-2.0
|
# SPDX-License-Identifier: GPL-2.0
|
||||||
# Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
|
# Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
|
||||||
|
|
||||||
import os.path
|
""" Test for bind command """
|
||||||
import pytest
|
|
||||||
import re
|
import re
|
||||||
|
import pytest
|
||||||
|
|
||||||
def in_tree(response, name, uclass, drv, depth, last_child):
|
def in_tree(response, name, uclass, drv, depth, last_child):
|
||||||
lines = [x.strip() for x in response.splitlines()]
|
lines = [x.strip() for x in response.splitlines()]
|
||||||
leaf = ''
|
leaf = ''
|
||||||
if depth != 0:
|
if depth != 0:
|
||||||
leaf = ' ' + ' ' * (depth - 1) ;
|
leaf = ' ' + ' ' * (depth - 1)
|
||||||
if not last_child:
|
if not last_child:
|
||||||
leaf = leaf + r'\|'
|
leaf = leaf + r'\|'
|
||||||
else:
|
else:
|
||||||
|
@ -108,7 +109,7 @@ def get_next_line(tree, name):
|
||||||
treelines = [x.strip() for x in tree.splitlines() if x.strip()]
|
treelines = [x.strip() for x in tree.splitlines() if x.strip()]
|
||||||
child_line = ''
|
child_line = ''
|
||||||
for idx, line in enumerate(treelines):
|
for idx, line in enumerate(treelines):
|
||||||
if ('-- ' + name) in line:
|
if '-- ' + name in line:
|
||||||
try:
|
try:
|
||||||
child_line = treelines[idx+1]
|
child_line = treelines[idx+1]
|
||||||
except:
|
except:
|
||||||
|
@ -131,7 +132,8 @@ def test_bind_unbind_with_uclass(u_boot_console):
|
||||||
child2_index = int(child2_line[0].split()[1])
|
child2_index = int(child2_line[0].split()[1])
|
||||||
|
|
||||||
#bind simple_bus as a child of bind-test-child2
|
#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
|
#check that the child is there and its uclass/index pair is right
|
||||||
tree = u_boot_console.run_command('dm tree')
|
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 == ''
|
assert child_of_child2_line == ''
|
||||||
|
|
||||||
#bind simple_bus as a child of bind-test-child2
|
#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
|
#check that the child is there and its uclass/index pair is right
|
||||||
tree = u_boot_console.run_command('dm tree')
|
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
|
assert child_of_child2_index == child2_index + 1
|
||||||
|
|
||||||
#unbind the child and check it has been removed
|
#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 == ''
|
assert response == ''
|
||||||
|
|
||||||
tree = u_boot_console.run_command('dm tree')
|
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
|
#unbind the child again and check it doesn't change the tree
|
||||||
tree_old = u_boot_console.run_command('dm 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')
|
tree_new = u_boot_console.run_command('dm tree')
|
||||||
|
|
||||||
assert response == ''
|
assert response == ''
|
||||||
|
|
Loading…
Add table
Reference in a new issue