Skip to content

Commit

Permalink
Add timeout as argument
Browse files Browse the repository at this point in the history
  • Loading branch information
lukamac committed Oct 25, 2023
1 parent c4b66af commit a1ff2ed
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
8 changes: 8 additions & 0 deletions test/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ def pytest_addoption(parser):
default=False,
help="Save the generated test data to their respective folders.",
)
parser.addoption(
"--timeout",
type=int,
default=120,
help="Execution timeout in seconds. Default: 120s"
)


def _find_test_dirs(path: Union[str, os.PathLike]):
Expand All @@ -55,6 +61,7 @@ def pytest_generate_tests(metafunc):
test_dirs = metafunc.config.getoption("test_dirs")
recursive = metafunc.config.getoption("recursive")
regenerate = metafunc.config.getoption("regenerate")
timeout = metafunc.config.getoption("timeout")

if recursive:
tests_dirs = test_dirs
Expand All @@ -70,3 +77,4 @@ def pytest_generate_tests(metafunc):
test.save_data(test_dir)

metafunc.parametrize("path", test_dirs)
metafunc.parametrize("timeout", [timeout])
4 changes: 2 additions & 2 deletions test/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,14 @@ def assert_message(
return retval


def test(path: str):
def test(path: str, timeout: int):
test_name = path
test = Ne16Test.load(path)

Ne16TestHeaderGenerator().generate(test_name, test)

cmd = f"make -C app all run platform=gvsoc"
passed, msg, stdout, stderr = execute_command(cmd=cmd, timeout=120)
passed, msg, stdout, stderr = execute_command(cmd=cmd, timeout=timeout)

assert passed, assert_message(msg, test_name, cmd, stdout, stderr)

Expand Down

0 comments on commit a1ff2ed

Please sign in to comment.