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>
This commit is contained in:
parent
26d7c61370
commit
3c7968172e
1 changed files with 22 additions and 0 deletions
22
scripts/tests/twister/test_errors.py
Normal file
22
scripts/tests/twister/test_errors.py
Normal file
|
@ -0,0 +1,22 @@
|
|||
#!/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)
|
Loading…
Add table
Add a link
Reference in a new issue