mirror of
https://github.com/onyx-and-iris/vban-cmd-python.git
synced 2025-04-18 11:13:54 +01:00
Compare commits
No commits in common. "9c0e2bef39bd2d0252574f9d6e57298ac0fd84ea" and "79260a0e475c50a248c754d5e82d3110d753a5eb" have entirely different histories.
9c0e2bef39
...
79260a0e47
12
CHANGELOG.md
12
CHANGELOG.md
@ -11,18 +11,6 @@ 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.9"
|
version = "2.4.8"
|
||||||
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,5 +1,3 @@
|
|||||||
import re
|
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
import vban_cmd
|
import vban_cmd
|
||||||
@ -17,15 +15,16 @@ 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 = "\n".join(
|
EXPECTED_MSG = (
|
||||||
(
|
f"No config with name 'unknown' is loaded into memory",
|
||||||
f"No config with name 'unknown' is loaded into memory",
|
f"Known configs: {list(vban.configs.keys())}",
|
||||||
f"Known configs: {list(vban.configs.keys())}",
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
with pytest.raises(vban_cmd.error.VBANCMDError, match=re.escape(EXPECTED_MSG)):
|
with pytest.raises(vban_cmd.error.VBANCMDError) as exc_info:
|
||||||
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,13 +148,8 @@ 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
|
return False
|
||||||
try:
|
self.parser = dataextraction_factory(data)
|
||||||
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,6 +1,13 @@
|
|||||||
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