vban-cmd-python/tests/__init__.py

52 lines
1.1 KiB
Python
Raw Normal View History

2023-08-10 19:13:34 +01:00
import os
import random
import sys
from dataclasses import dataclass
import vban_cmd
2023-06-25 14:23:39 +01:00
from vban_cmd.kinds import KindId
from vban_cmd.kinds import request_kind_map as kindmap
2023-08-10 19:13:34 +01:00
# get KIND_ID from env var, otherwise set to random
KIND_ID = os.environ.get(
"KIND", random.choice(tuple(kind_id.name.lower() for kind_id in KindId))
)
2022-02-25 15:17:05 +00:00
opts = {
2023-06-25 14:23:39 +01:00
"ip": "testing.local",
"streamname": "testing",
"port": 6990,
"bps": 0,
}
2022-02-25 15:17:05 +00:00
2023-06-25 14:23:39 +01:00
vban = vban_cmd.api(KIND_ID, **opts)
kind = kindmap(KIND_ID)
@dataclass
class Data:
"""bounds data to map tests to a kind"""
name: str = kind.name
phys_in: int = kind.ins[0] - 1
virt_in: int = kind.ins[0] + kind.ins[1] - 1
phys_out: int = kind.outs[0] - 1
virt_out: int = kind.outs[0] + kind.outs[1] - 1
vban_in: int = kind.vban[0] - 1
vban_out: int = kind.vban[1] - 1
button_lower: int = 0
button_upper: int = 79
data = Data()
2022-02-25 15:17:05 +00:00
def setup_module():
print(f"\nRunning tests for kind [{data.name}]\n", file=sys.stdout)
2023-06-25 14:23:39 +01:00
vban.login()
vban.command.reset()
def teardown_module():
2023-06-25 14:23:39 +01:00
vban.logout()