zephyr/samples/subsys/testsuite/pytest/shell/pytest/test_shell.py
Grzegorz Chwierut f618522144 twister: pytest: Move fixtures to one file
Fixtures in pytest-twister-harness plugin are moved to one
file to simplify adding new fixtures in the future - no
need to add pytest_plugins entry and register asserts.
Moved also shell fixture from sample dir, because that
fixture can be reused in new tests.

Signed-off-by: Grzegorz Chwierut <grzegorz.chwierut@nordicsemi.no>
2023-09-14 05:58:25 -04:00

24 lines
679 B
Python
Executable File

# Copyright (c) 2023 Nordic Semiconductor ASA
#
# SPDX-License-Identifier: Apache-2.0
import logging
from twister_harness import Shell
logger = logging.getLogger(__name__)
def test_shell_print_help(shell: Shell):
logger.info('send "help" command')
lines = shell.exec_command('help')
assert 'Available commands:' in lines, 'expected response not found'
logger.info('response is valid')
def test_shell_print_version(shell: Shell):
logger.info('send "kernel version" command')
lines = shell.exec_command('kernel version')
assert any(['Zephyr version' in line for line in lines]), 'expected response not found'
logger.info('response is valid')