zephyr/scripts/tests/twister/test_errors.py
Lukasz Mrugala 3c7968172e scripts: tests: twister: Add error testing
Errors did not have their dedicated test file.
This change adds it to the repo and
checks the only non-def statement there.

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2023-10-30 08:27:43 -04:00

23 lines
516 B
Python

#!/usr/bin/env python3
# Copyright (c) 2023 Intel Corporation
#
# SPDX-License-Identifier: Apache-2.0
"""
Tests for the error classes
"""
import os
import pytest
from pathlib import Path
from twisterlib.error import ConfigurationError
def test_configurationerror():
cfile = Path('some') / 'path'
message = 'dummy message'
expected_err = f'{os.path.join("some", "path")}: dummy message'
with pytest.raises(ConfigurationError, match=expected_err):
raise ConfigurationError(cfile, message)