File: test_example.py

package info (click to toggle)
labgrid 25.0.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,796 kB
  • sloc: python: 21,352; sh: 846; makefile: 35
file content (35 lines) | stat: -rw-r--r-- 900 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import pytest


@pytest.fixture(scope="function")
def bootloader(target, strategy, capsys):
    with capsys.disabled():
        strategy.transition("barebox")
    return target["CommandProtocol"]  # this will return the BareboxDriver


@pytest.fixture(scope="function")
def shell(target, strategy, capsys):
    with capsys.disabled():
        strategy.transition("shell")
    return target["CommandProtocol"]  # this will return the ShellDriver


def test_barebox(bootloader):
    stdout, stderr, returncode = bootloader.run("version")
    assert returncode == 0
    assert stdout
    assert not stderr
    assert "barebox" in "\n".join(stdout)


def test_shell(shell):
    stdout, stderr, returncode = shell.run("cat /proc/version")
    assert returncode == 0
    assert stdout
    assert not stderr
    assert "Linux" in stdout[0]


def test_barebox_2(bootloader):
    bootloader.run_check("true")