Skip to content

Commit

Permalink
fix flake8 error
Browse files Browse the repository at this point in the history
  • Loading branch information
lizhijianrd committed Jun 7, 2024
1 parent 69d465b commit 72fb466
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion consutil/lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ def init_device_prefix():
@staticmethod
def list_console_ttys():
"""Lists all console tty devices"""
cmd = ["bash", "-c" , "ls " + SysInfoProvider.DEVICE_PREFIX + "*"]
cmd = ["bash", "-c", "ls " + SysInfoProvider.DEVICE_PREFIX + "*"]
output, _ = SysInfoProvider.run_command(cmd, abort=False)
ttys = output.split('\n')
ttys = list([dev for dev in ttys if re.match(SysInfoProvider.DEVICE_PREFIX + r"\d+", dev) != None])
Expand Down
5 changes: 3 additions & 2 deletions tests/console_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@

from click.testing import CliRunner
from utilities_common.db import Db
from consutil.lib import *
from consutil.lib import ConsolePortProvider, ConsolePortInfo, ConsoleSession, SysInfoProvider, DbUtils, \
InvalidConfigurationError, LineBusyError, LineNotFoundError, ConnectionFailedError
from sonic_py_common import device_info
from jsonpatch import JsonPatchConflict

Expand Down Expand Up @@ -555,7 +556,7 @@ def test_sys_info_provider_list_console_ttys(self):
assert len(ttys) == 1

def test_sys_info_provider_list_console_ttys_device_not_exists(self):
SysInfoProvider.DEVICE_PREFIX = CONSOLE_MOCK_DIR + "/dev_inexistent/ttyUSB"
SysInfoProvider.DEVICE_PREFIX = CONSOLE_MOCK_DIR + "/dev_not_exist/ttyUSB"
ttys = SysInfoProvider.list_console_ttys()
assert len(ttys) == 0

Expand Down

0 comments on commit 72fb466

Please sign in to comment.