mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-03-18 21:21:37 +00:00
test: py: Use global pytestmark for hush tests
All tests in test_hush_if_test depends on hush parser to be present. This patch simplify test dependencies by using global pytestmark. Reported-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Michal Simek <michal.simek@xilinx.com> Acked-by: Stephen Warren <swarren@nvidia.com>
This commit is contained in:
parent
dbf0518b60
commit
a5b548138b
1 changed files with 2 additions and 4 deletions
|
@ -8,6 +8,8 @@ import os
|
||||||
import os.path
|
import os.path
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
pytestmark = pytest.mark.buildconfigspec('hush_parser')
|
||||||
|
|
||||||
# The list of "if test" conditions to test.
|
# The list of "if test" conditions to test.
|
||||||
subtests = (
|
subtests = (
|
||||||
# Base if functionality.
|
# Base if functionality.
|
||||||
|
@ -109,27 +111,23 @@ def exec_hush_if(u_boot_console, expr, result):
|
||||||
response = u_boot_console.run_command(cmd)
|
response = u_boot_console.run_command(cmd)
|
||||||
assert response.strip() == str(result).lower()
|
assert response.strip() == str(result).lower()
|
||||||
|
|
||||||
@pytest.mark.buildconfigspec('hush_parser')
|
|
||||||
def test_hush_if_test_setup(u_boot_console):
|
def test_hush_if_test_setup(u_boot_console):
|
||||||
"""Set up environment variables used during the "if" tests."""
|
"""Set up environment variables used during the "if" tests."""
|
||||||
|
|
||||||
u_boot_console.run_command('setenv ut_var_nonexistent')
|
u_boot_console.run_command('setenv ut_var_nonexistent')
|
||||||
u_boot_console.run_command('setenv ut_var_exists 1')
|
u_boot_console.run_command('setenv ut_var_exists 1')
|
||||||
|
|
||||||
@pytest.mark.buildconfigspec('hush_parser')
|
|
||||||
@pytest.mark.parametrize('expr,result', subtests)
|
@pytest.mark.parametrize('expr,result', subtests)
|
||||||
def test_hush_if_test(u_boot_console, expr, result):
|
def test_hush_if_test(u_boot_console, expr, result):
|
||||||
"""Test a single "if test" condition."""
|
"""Test a single "if test" condition."""
|
||||||
|
|
||||||
exec_hush_if(u_boot_console, expr, result)
|
exec_hush_if(u_boot_console, expr, result)
|
||||||
|
|
||||||
@pytest.mark.buildconfigspec('hush_parser')
|
|
||||||
def test_hush_if_test_teardown(u_boot_console):
|
def test_hush_if_test_teardown(u_boot_console):
|
||||||
"""Clean up environment variables used during the "if" tests."""
|
"""Clean up environment variables used during the "if" tests."""
|
||||||
|
|
||||||
u_boot_console.run_command('setenv ut_var_exists')
|
u_boot_console.run_command('setenv ut_var_exists')
|
||||||
|
|
||||||
@pytest.mark.buildconfigspec('hush_parser')
|
|
||||||
# We might test this on real filesystems via UMS, DFU, 'save', etc.
|
# We might test this on real filesystems via UMS, DFU, 'save', etc.
|
||||||
# Of those, only UMS currently allows file removal though.
|
# Of those, only UMS currently allows file removal though.
|
||||||
@pytest.mark.boardspec('sandbox')
|
@pytest.mark.boardspec('sandbox')
|
||||||
|
|
Loading…
Add table
Reference in a new issue