mirror of
https://github.com/onyx-and-iris/vban-cmd-python.git
synced 2026-04-06 23:53:31 +00:00
edits to tests
add more tests to higher. added opts to tests. removed delay, max_polls from runmany, not required for these tests.
This commit is contained in:
@@ -3,18 +3,26 @@ from vban_cmd import kinds
|
||||
from vban_cmd.channel import Modes
|
||||
import socket
|
||||
from threading import Thread
|
||||
from time import sleep
|
||||
|
||||
_kind = 'banana'
|
||||
_kind = 'potato'
|
||||
opts = {
|
||||
'ip': 'ws.local',
|
||||
'streamname': 'testing',
|
||||
'port': 6980,
|
||||
'bps': 0,
|
||||
}
|
||||
|
||||
vbanrs = {kind.id: vban_cmd.connect(_kind, ip='ws.local') for kind in kinds.all}
|
||||
vbanrs = {kind.id: vban_cmd.connect(_kind, **opts) for kind in kinds.all}
|
||||
tests = vbanrs[_kind]
|
||||
|
||||
def setup_package():
|
||||
tests._rt_packet_socket.bind((socket.gethostbyname(socket.gethostname()), tests._port))
|
||||
tests.worker = Thread(target=tests._send_register_rt, daemon=True)
|
||||
tests.worker.start()
|
||||
|
||||
tests._modes = Modes()
|
||||
|
||||
def teardown_package():
|
||||
pass
|
||||
tests._rt_packet_socket.close()
|
||||
tests._rt_register_socket.close()
|
||||
tests._sendrequest_string_socket.close()
|
||||
|
||||
@@ -19,17 +19,6 @@ Function RunTests {
|
||||
|
||||
if ($cycle_num -eq 20) { $firstrun = $true }
|
||||
|
||||
(Get-Content '__init__.py') | ForEach-Object {
|
||||
$m = [regex]::Match($_, '^(DELAY)\s=\s(\d.\d+)')
|
||||
if ($m.captures.groups.count -gt 1) {
|
||||
$delay = $m.captures.groups[2]
|
||||
}
|
||||
$m = [regex]::Match($_, '^(MAX_POLLS)\s=\s(\d+)')
|
||||
if ($m.captures.groups.count -gt 1) {
|
||||
$maxpolls = $m.captures.groups[2]
|
||||
}
|
||||
}
|
||||
|
||||
1..$num | ForEach-Object { `
|
||||
if ($Log) { "Running test $_ of ${num} runs" | Tee-Object -FilePath $logfile -Append }
|
||||
else { Write-Host "Running test $_ of ${num} runs" }
|
||||
@@ -60,14 +49,12 @@ Function RunTests {
|
||||
"NOTES:" | Tee-Object -FilePath $summary_file -Append
|
||||
}
|
||||
"===========================================================`n" + `
|
||||
"${num} test run with ${delay} delay and ${maxpolls} max_polls`n" + `
|
||||
"Total failures: ${failures}`n" + `
|
||||
"Logfile for this test run: ${log_backupfile}`n" + `
|
||||
"===========================================================" | `
|
||||
Tee-Object -FilePath $summary_file -Append
|
||||
} else {
|
||||
"===========================================================",
|
||||
"${num} test run with ${delay} delay and ${maxpolls} max_polls",
|
||||
"Total failures: ${failures}",
|
||||
"===========================================================" | Write-Host
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ from tests import tests
|
||||
class TestSetAndGetBoolHigher(unittest.TestCase):
|
||||
""" strip tests, physical and virtual """
|
||||
@parameterized.expand([
|
||||
(0, 'mute'), (2, 'mono'), (3, 'A1'), (3, 'B3')
|
||||
(0, 'mute'), (2, 'mono'), (3, 'A1'), (6, 'B3'), (6, 'mute'),
|
||||
])
|
||||
def test_it_sets_and_gets_strip_bool_params(self, index, param):
|
||||
setattr(tests.strip[index], param, self.val)
|
||||
@@ -19,6 +19,16 @@ class TestSetAndGetBoolHigher(unittest.TestCase):
|
||||
self.assertTrue(isinstance(retval, bool))
|
||||
assert_equal(retval, self.val)
|
||||
|
||||
""" bus tests, physical and virtual """
|
||||
@parameterized.expand([
|
||||
(0, 'mute'), (2, 'mono'), (6, 'mute'), (2, 'eq'), (7, 'eq_ab')
|
||||
])
|
||||
def test_it_sets_and_gets_bus_bool_params(self, index, param):
|
||||
setattr(tests.bus[index], param, self.val)
|
||||
retval = getattr(tests.bus[index], param)
|
||||
self.assertTrue(isinstance(retval, bool))
|
||||
assert_equal(retval, self.val)
|
||||
|
||||
|
||||
#@nottest
|
||||
@parameterized_class([
|
||||
@@ -27,7 +37,7 @@ class TestSetAndGetBoolHigher(unittest.TestCase):
|
||||
class TestSetAndGetStringHigher(unittest.TestCase):
|
||||
""" strip tests, physical and virtual """
|
||||
@parameterized.expand([
|
||||
(2, 'label'), (3, 'label')
|
||||
(2, 'label'), (6, 'label')
|
||||
])
|
||||
def test_it_sets_and_gets_strip_string_params(self, index, param):
|
||||
setattr(tests.strip[index], param, self.val)
|
||||
@@ -35,8 +45,29 @@ class TestSetAndGetStringHigher(unittest.TestCase):
|
||||
|
||||
""" bus tests, physical and virtual """
|
||||
@parameterized.expand([
|
||||
(0, 'label'), (4, 'label')
|
||||
(0, 'label'), (7, 'label')
|
||||
])
|
||||
def test_it_sets_and_gets_bus_string_params(self, index, param):
|
||||
setattr(tests.bus[index], param, self.val)
|
||||
assert_equal(getattr(tests.bus[index], param), self.val)
|
||||
|
||||
|
||||
#@nottest
|
||||
class TestSetAndGetFloatHigher(unittest.TestCase):
|
||||
""" strip tests, physical and virtual """
|
||||
@parameterized.expand([
|
||||
(0, 1, 'gain', -6.3), (7, 4, 'gain', -12.5), (3, 3, 'gain', 3.3)
|
||||
])
|
||||
def test_it_sets_and_gets_strip_float_params(self, index, j, param, val):
|
||||
setattr(tests.strip[index].gainlayer[j], param, val)
|
||||
retval = getattr(tests.strip[index].gainlayer[j], param)
|
||||
assert_equal(retval, val)
|
||||
|
||||
""" bus tests, physical and virtual """
|
||||
@parameterized.expand([
|
||||
(0, 'gain', -6.3), (7, 'gain', -12.5), (3, 'gain', 3.3)
|
||||
])
|
||||
def test_it_sets_and_gets_bus_float_params(self, index, param, val):
|
||||
setattr(tests.bus[index], param, val)
|
||||
retval = getattr(tests.bus[index], param)
|
||||
assert_equal(retval, val)
|
||||
|
||||
Reference in New Issue
Block a user