mirror of
https://github.com/onyx-and-iris/vban-cmd-python.git
synced 2025-04-09 07:03:52 +01:00
Compare commits
4 Commits
79260a0e47
...
9c0e2bef39
Author | SHA1 | Date | |
---|---|---|---|
9c0e2bef39 | |||
36692d1bc7 | |||
753714b639 | |||
27a26b8fe9 |
12
CHANGELOG.md
12
CHANGELOG.md
@ -11,6 +11,18 @@ Before any major/minor/patch bump all unit tests will be run to verify they pass
|
|||||||
|
|
||||||
- [x]
|
- [x]
|
||||||
|
|
||||||
|
## [2.4.9] - 2023-08-13
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Error tests added in tests/test_errors.py
|
||||||
|
- Errors section in README updated.
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- VBANCMDConnectionError class now subclasses VBANCMDError
|
||||||
|
- If the configs loader is passed an invalid config TOML it will log an error but continue to load further configs into memory.
|
||||||
|
|
||||||
## [2.3.2] - 2023-07-12
|
## [2.3.2] - 2023-07-12
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "vban-cmd"
|
name = "vban-cmd"
|
||||||
version = "2.4.8"
|
version = "2.4.9"
|
||||||
description = "Python interface for the VBAN RT Packet Service (Sendtext)"
|
description = "Python interface for the VBAN RT Packet Service (Sendtext)"
|
||||||
authors = ["onyx-and-iris <code@onyxandiris.online>"]
|
authors = ["onyx-and-iris <code@onyxandiris.online>"]
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
import re
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
import vban_cmd
|
import vban_cmd
|
||||||
@ -15,16 +17,15 @@ class TestErrors:
|
|||||||
vban_cmd.api("unknown_kind")
|
vban_cmd.api("unknown_kind")
|
||||||
|
|
||||||
def test_it_tests_an_unknown_config_name(self):
|
def test_it_tests_an_unknown_config_name(self):
|
||||||
EXPECTED_MSG = (
|
EXPECTED_MSG = "\n".join(
|
||||||
f"No config with name 'unknown' is loaded into memory",
|
(
|
||||||
f"Known configs: {list(vban.configs.keys())}",
|
f"No config with name 'unknown' is loaded into memory",
|
||||||
|
f"Known configs: {list(vban.configs.keys())}",
|
||||||
|
)
|
||||||
)
|
)
|
||||||
with pytest.raises(vban_cmd.error.VBANCMDError) as exc_info:
|
with pytest.raises(vban_cmd.error.VBANCMDError, match=re.escape(EXPECTED_MSG)):
|
||||||
vban.apply_config("unknown")
|
vban.apply_config("unknown")
|
||||||
|
|
||||||
e = exc_info.value
|
|
||||||
assert e.message == "\n".join(EXPECTED_MSG)
|
|
||||||
|
|
||||||
def test_it_tests_an_invalid_config_key(self):
|
def test_it_tests_an_invalid_config_key(self):
|
||||||
CONFIG = {
|
CONFIG = {
|
||||||
"strip-0": {"A1": True, "B1": True, "gain": -6.0},
|
"strip-0": {"A1": True, "B1": True, "gain": -6.0},
|
||||||
|
@ -148,8 +148,13 @@ class Loader(metaclass=SingletonType):
|
|||||||
self.logger.info(
|
self.logger.info(
|
||||||
f"config file with name {identifier} already in memory, skipping.."
|
f"config file with name {identifier} already in memory, skipping.."
|
||||||
)
|
)
|
||||||
return False
|
return
|
||||||
self.parser = dataextraction_factory(data)
|
try:
|
||||||
|
self.parser = dataextraction_factory(data)
|
||||||
|
except tomllib.TOMLDecodeError as e:
|
||||||
|
ERR_MSG = (str(e), f"When attempting to load {identifier}.toml")
|
||||||
|
self.logger.error(f"{type(e).__name__}: {' '.join(ERR_MSG)}")
|
||||||
|
return
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def register(self, identifier, data=None):
|
def register(self, identifier, data=None):
|
||||||
|
@ -1,13 +1,6 @@
|
|||||||
class VBANCMDError(Exception):
|
class VBANCMDError(Exception):
|
||||||
"""Base VBANCMD Exception class. Raised when general errors occur"""
|
"""Base VBANCMD Exception class. Raised when general errors occur"""
|
||||||
|
|
||||||
def __init__(self, msg):
|
|
||||||
self.message = msg
|
|
||||||
super().__init__(self.message)
|
|
||||||
|
|
||||||
def __str__(self):
|
|
||||||
return f"{type(self).__name__}: {self.message}"
|
|
||||||
|
|
||||||
|
|
||||||
class VBANCMDConnectionError(VBANCMDError):
|
class VBANCMDConnectionError(VBANCMDError):
|
||||||
"""Exception raised when connection/timeout errors occur"""
|
"""Exception raised when connection/timeout errors occur"""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user