Compare commits

..

5 Commits

Author SHA1 Message Date
0396892530 fix url 2026-03-07 21:34:26 +00:00
919dc0d325 requires-plugins seems to be bugged on Windows... see https://github.com/python-poetry/poetry/issues/10028
upd poe dep so it uses the one in poetry environment
2026-03-07 21:27:01 +00:00
0a81c458e2 add publish+ruff actions 2026-03-07 21:23:56 +00:00
9903ecca72 run through formatter 2026-03-07 21:23:37 +00:00
00ac5b1428 fix bus.mono type (bool -> int)
patch bump
2026-03-07 21:23:08 +00:00
11 changed files with 334 additions and 257 deletions

53
.github/workflows/publish.yml vendored Normal file
View File

@ -0,0 +1,53 @@
name: Publish to PyPI
on:
release:
types: [published]
push:
tags:
- 'v*.*.*'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install Poetry
run: |
pip install poetry==2.3.1
poetry --version
- name: Build package
run: |
poetry install --only-root
poetry build
- uses: actions/upload-artifact@v4
with:
name: dist
path: ./dist
pypi-publish:
needs: build
name: Upload release to PyPI
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/project/voicemeeter-api/
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v4
with:
name: dist
path: ./dist
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: ./dist

19
.github/workflows/ruff.yml vendored Normal file
View File

@ -0,0 +1,19 @@
name: Ruff
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
jobs:
ruff:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: astral-sh/ruff-action@v3
with:
args: 'format --check --diff'

View File

@ -277,7 +277,7 @@ Level properties will return -200.0 if no audio detected.
The following properties are available. The following properties are available.
- `mono`: boolean - `mono`: int, from 0 up to 2
- `mute`: boolean - `mute`: boolean
- `sel`: boolean - `sel`: boolean
- `gain`: float, from -60.0 to 12.0 - `gain`: float, from -60.0 to 12.0
@ -294,7 +294,7 @@ example:
vm.bus[3].gain = 3.7 vm.bus[3].gain = 3.7
print(vm.bus[0].label) print(vm.bus[0].label)
vm.bus[4].mono = True vm.bus[4].mono = 2
``` ```
##### Bus.EQ ##### Bus.EQ

View File

@ -1,22 +1,18 @@
[project] [project]
name = "voicemeeter-api" name = "voicemeeter-api"
version = "2.7.1" version = "2.7.2"
description = "A Python wrapper for the Voiceemeter API" description = "A Python wrapper for the Voiceemeter API"
authors = [ authors = [{ name = "Onyx and Iris", email = "code@onyxandiris.online" }]
{name = "Onyx and Iris",email = "code@onyxandiris.online"} license = { text = "MIT" }
]
license = {text = "MIT"}
readme = "README.md" readme = "README.md"
requires-python = ">=3.10" requires-python = ">=3.10"
dependencies = [ dependencies = ["tomli (>=2.0.1,<3.0) ; python_version < '3.11'"]
"tomli (>=2.0.1,<3.0) ; python_version < '3.11'",
]
[tool.poetry] [tool.poetry]
packages = [{ include = "voicemeeterlib" }] packages = [{ include = "voicemeeterlib" }]
[tool.poetry.requires-plugins] [tool.poetry.requires-plugins]
poethepoet = "^0.35.0" poethepoet = ">=0.42.0"
[tool.poetry.group.dev.dependencies] [tool.poetry.group.dev.dependencies]
pytest = "^8.3.4" pytest = "^8.3.4"
@ -125,7 +121,4 @@ docstring-code-line-length = "dynamic"
max-complexity = 10 max-complexity = 10
[tool.ruff.lint.per-file-ignores] [tool.ruff.lint.per-file-ignores]
"__init__.py" = [ "__init__.py" = ["E402", "F401"]
"E402",
"F401",
]

View File

@ -1,7 +1,7 @@
def pytest_addoption(parser): def pytest_addoption(parser):
parser.addoption( parser.addoption(
"--run-slow", '--run-slow',
action="store_true", action='store_true',
default=False, default=False,
help="Run slow tests", help='Run slow tests',
) )

View File

@ -10,37 +10,37 @@ class TestUserConfigs:
@classmethod @classmethod
def setup_class(cls): def setup_class(cls):
vm.apply_config("example") vm.apply_config('example')
def test_it_tests_vm_config_string(self): def test_it_tests_vm_config_string(self):
assert "PhysStrip" in vm.strip[data.phys_in].label assert 'PhysStrip' in vm.strip[data.phys_in].label
assert "VirtStrip" in vm.strip[data.virt_in].label assert 'VirtStrip' in vm.strip[data.virt_in].label
assert "PhysBus" in vm.bus[data.phys_out].label assert 'PhysBus' in vm.bus[data.phys_out].label
assert "VirtBus" in vm.bus[data.virt_out].label assert 'VirtBus' in vm.bus[data.virt_out].label
def test_it_tests_vm_config_bool(self): def test_it_tests_vm_config_bool(self):
assert vm.strip[0].A1 == True assert vm.strip[0].A1 == True
@pytest.mark.skipif( @pytest.mark.skipif(
data.name != "potato", data.name != 'potato',
reason="Skip test if kind is not potato", reason='Skip test if kind is not potato',
) )
def test_it_tests_vm_config_bool_strip_eq_on(self): def test_it_tests_vm_config_bool_strip_eq_on(self):
assert vm.strip[data.phys_in].eq.on == True assert vm.strip[data.phys_in].eq.on == True
@pytest.mark.skipif( @pytest.mark.skipif(
data.name != "banana", data.name != 'banana',
reason="Skip test if kind is not banana", reason='Skip test if kind is not banana',
) )
def test_it_tests_vm_config_bool_bus_eq_ab(self): def test_it_tests_vm_config_bool_bus_eq_ab(self):
assert vm.bus[data.phys_out].eq.ab == True assert vm.bus[data.phys_out].eq.ab == True
@pytest.mark.skipif( @pytest.mark.skipif(
"not config.getoption('--run-slow')", "not config.getoption('--run-slow')",
reason="Only run when --run-slow is given", reason='Only run when --run-slow is given',
) )
def test_it_tests_vm_config_busmode(self): def test_it_tests_vm_config_busmode(self):
assert vm.bus[data.phys_out].mode.get() == "composite" assert vm.bus[data.phys_out].mode.get() == 'composite'
def test_it_tests_vm_config_bass_med_high(self): def test_it_tests_vm_config_bass_med_high(self):
assert vm.strip[data.virt_in].bass == -3.2 assert vm.strip[data.virt_in].bass == -3.2

View File

@ -3,7 +3,7 @@ import re
import pytest import pytest
import voicemeeterlib import voicemeeterlib
from tests import data, vm from tests import vm
class TestErrors: class TestErrors:
@ -14,36 +14,36 @@ class TestErrors:
voicemeeterlib.error.VMError, voicemeeterlib.error.VMError,
match="Unknown Voicemeeter kind 'unknown_kind'", match="Unknown Voicemeeter kind 'unknown_kind'",
): ):
voicemeeterlib.api("unknown_kind") voicemeeterlib.api('unknown_kind')
def test_it_tests_an_unknown_parameter(self): def test_it_tests_an_unknown_parameter(self):
with pytest.raises( with pytest.raises(
voicemeeterlib.error.CAPIError, voicemeeterlib.error.CAPIError,
match="VBVMR_SetParameterFloat returned -3", match='VBVMR_SetParameterFloat returned -3',
) as exc_info: ) as exc_info:
vm.set("unknown.parameter", 1) vm.set('unknown.parameter', 1)
e = exc_info.value e = exc_info.value
assert e.code == -3 assert e.code == -3
assert e.fn_name == "VBVMR_SetParameterFloat" assert e.fn_name == 'VBVMR_SetParameterFloat'
def test_it_tests_an_unknown_config_name(self): def test_it_tests_an_unknown_config_name(self):
EXPECTED_MSG = ( EXPECTED_MSG = (
"No config with name 'unknown' is loaded into memory", "No config with name 'unknown' is loaded into memory",
f"Known configs: {list(vm.configs.keys())}", f'Known configs: {list(vm.configs.keys())}',
) )
with pytest.raises( with pytest.raises(
voicemeeterlib.error.VMError, match=re.escape("\n".join(EXPECTED_MSG)) voicemeeterlib.error.VMError, match=re.escape('\n'.join(EXPECTED_MSG))
): ):
vm.apply_config("unknown") vm.apply_config('unknown')
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},
"bus-0": {"mute": True, "eq": {"on": True}}, 'bus-0': {'mute': True, 'eq': {'on': True}},
"unknown-0": {"state": True}, 'unknown-0': {'state': True},
"vban-out-1": {"name": "streamname"}, 'vban-out-1': {'name': 'streamname'},
} }
with pytest.raises(ValueError, match="invalid config key 'unknown-0'"): with pytest.raises(ValueError, match="invalid config key 'unknown-0'"):
vm.apply(CONFIG) vm.apply(CONFIG)

View File

@ -7,17 +7,17 @@ class TestRemoteFactories:
__test__ = True __test__ = True
@pytest.mark.skipif( @pytest.mark.skipif(
data.name != "basic", data.name != 'basic',
reason="Skip test if kind is not basic", reason='Skip test if kind is not basic',
) )
def test_it_tests_vm_remote_attrs_for_basic(self): def test_it_tests_vm_remote_attrs_for_basic(self):
assert hasattr(vm, "strip") assert hasattr(vm, 'strip')
assert hasattr(vm, "bus") assert hasattr(vm, 'bus')
assert hasattr(vm, "command") assert hasattr(vm, 'command')
assert hasattr(vm, "button") assert hasattr(vm, 'button')
assert hasattr(vm, "vban") assert hasattr(vm, 'vban')
assert hasattr(vm, "device") assert hasattr(vm, 'device')
assert hasattr(vm, "option") assert hasattr(vm, 'option')
assert len(vm.strip) == 3 assert len(vm.strip) == 3
assert len(vm.bus) == 2 assert len(vm.bus) == 2
@ -25,19 +25,19 @@ class TestRemoteFactories:
assert len(vm.vban.instream) == 6 and len(vm.vban.outstream) == 5 assert len(vm.vban.instream) == 6 and len(vm.vban.outstream) == 5
@pytest.mark.skipif( @pytest.mark.skipif(
data.name != "banana", data.name != 'banana',
reason="Skip test if kind is not banana", reason='Skip test if kind is not banana',
) )
def test_it_tests_vm_remote_attrs_for_banana(self): def test_it_tests_vm_remote_attrs_for_banana(self):
assert hasattr(vm, "strip") assert hasattr(vm, 'strip')
assert hasattr(vm, "bus") assert hasattr(vm, 'bus')
assert hasattr(vm, "command") assert hasattr(vm, 'command')
assert hasattr(vm, "button") assert hasattr(vm, 'button')
assert hasattr(vm, "vban") assert hasattr(vm, 'vban')
assert hasattr(vm, "device") assert hasattr(vm, 'device')
assert hasattr(vm, "option") assert hasattr(vm, 'option')
assert hasattr(vm, "recorder") assert hasattr(vm, 'recorder')
assert hasattr(vm, "patch") assert hasattr(vm, 'patch')
assert len(vm.strip) == 5 assert len(vm.strip) == 5
assert len(vm.bus) == 5 assert len(vm.bus) == 5
@ -45,20 +45,20 @@ class TestRemoteFactories:
assert len(vm.vban.instream) == 10 and len(vm.vban.outstream) == 9 assert len(vm.vban.instream) == 10 and len(vm.vban.outstream) == 9
@pytest.mark.skipif( @pytest.mark.skipif(
data.name != "potato", data.name != 'potato',
reason="Skip test if kind is not potato", reason='Skip test if kind is not potato',
) )
def test_it_tests_vm_remote_attrs_for_potato(self): def test_it_tests_vm_remote_attrs_for_potato(self):
assert hasattr(vm, "strip") assert hasattr(vm, 'strip')
assert hasattr(vm, "bus") assert hasattr(vm, 'bus')
assert hasattr(vm, "command") assert hasattr(vm, 'command')
assert hasattr(vm, "button") assert hasattr(vm, 'button')
assert hasattr(vm, "vban") assert hasattr(vm, 'vban')
assert hasattr(vm, "device") assert hasattr(vm, 'device')
assert hasattr(vm, "option") assert hasattr(vm, 'option')
assert hasattr(vm, "recorder") assert hasattr(vm, 'recorder')
assert hasattr(vm, "patch") assert hasattr(vm, 'patch')
assert hasattr(vm, "fx") assert hasattr(vm, 'fx')
assert len(vm.strip) == 8 assert len(vm.strip) == 8
assert len(vm.bus) == 8 assert len(vm.bus) == 8

View File

@ -3,19 +3,18 @@ import pytest
from tests import data, vm from tests import data, vm
@pytest.mark.parametrize("value", [False, True]) @pytest.mark.parametrize('value', [False, True])
class TestSetAndGetBoolHigher: class TestSetAndGetBoolHigher:
__test__ = True __test__ = True
"""strip tests, physical and virtual""" """strip tests, physical and virtual"""
@pytest.mark.parametrize( @pytest.mark.parametrize(
"index,param", 'index,param',
[ [
(data.phys_in, "mute"), (data.phys_in, 'mute'),
(data.phys_in, "mono"), (data.phys_in, 'mono'),
(data.virt_in, "mc"), (data.virt_in, 'mc'),
(data.virt_in, "mono"),
], ],
) )
def test_it_sets_and_gets_strip_bool_params(self, index, param, value): def test_it_sets_and_gets_strip_bool_params(self, index, param, value):
@ -25,14 +24,14 @@ class TestSetAndGetBoolHigher:
""" strip EQ tests, physical """ """ strip EQ tests, physical """
@pytest.mark.skipif( @pytest.mark.skipif(
data.name != "potato", data.name != 'potato',
reason="Skip test if kind is not potato", reason='Skip test if kind is not potato',
) )
@pytest.mark.parametrize( @pytest.mark.parametrize(
"index,param", 'index,param',
[ [
(data.phys_in, "on"), (data.phys_in, 'on'),
(data.phys_in, "ab"), (data.phys_in, 'ab'),
], ],
) )
def test_it_sets_and_gets_strip_eq_bool_params(self, index, param, value): def test_it_sets_and_gets_strip_eq_bool_params(self, index, param, value):
@ -43,10 +42,10 @@ class TestSetAndGetBoolHigher:
""" bus tests, physical and virtual """ """ bus tests, physical and virtual """
@pytest.mark.parametrize( @pytest.mark.parametrize(
"index,param", 'index,param',
[ [
(data.phys_out, "mute"), (data.phys_out, 'mute'),
(data.virt_out, "sel"), (data.virt_out, 'sel'),
], ],
) )
def test_it_sets_and_gets_bus_bool_params(self, index, param, value): def test_it_sets_and_gets_bus_bool_params(self, index, param, value):
@ -57,10 +56,10 @@ class TestSetAndGetBoolHigher:
""" bus EQ tests, physical and virtual """ """ bus EQ tests, physical and virtual """
@pytest.mark.parametrize( @pytest.mark.parametrize(
"index,param", 'index,param',
[ [
(data.phys_out, "on"), (data.phys_out, 'on'),
(data.virt_out, "ab"), (data.virt_out, 'ab'),
], ],
) )
def test_it_sets_and_gets_bus_eq_bool_params(self, index, param, value): def test_it_sets_and_gets_bus_eq_bool_params(self, index, param, value):
@ -71,16 +70,16 @@ class TestSetAndGetBoolHigher:
""" bus modes tests, physical and virtual """ """ bus modes tests, physical and virtual """
@pytest.mark.skipif( @pytest.mark.skipif(
data.name != "basic", data.name != 'basic',
reason="Skip test if kind is not basic", reason='Skip test if kind is not basic',
) )
@pytest.mark.parametrize( @pytest.mark.parametrize(
"index,param", 'index,param',
[ [
(data.phys_out, "normal"), (data.phys_out, 'normal'),
(data.phys_out, "amix"), (data.phys_out, 'amix'),
(data.virt_out, "normal"), (data.virt_out, 'normal'),
(data.virt_out, "composite"), (data.virt_out, 'composite'),
], ],
) )
def test_it_sets_and_gets_busmode_basic_bool_params(self, index, param, value): def test_it_sets_and_gets_busmode_basic_bool_params(self, index, param, value):
@ -88,18 +87,18 @@ class TestSetAndGetBoolHigher:
assert getattr(vm.bus[index].mode, param) == value assert getattr(vm.bus[index].mode, param) == value
@pytest.mark.skipif( @pytest.mark.skipif(
data.name == "basic", data.name == 'basic',
reason="Skip test if kind is basic", reason='Skip test if kind is basic',
) )
@pytest.mark.parametrize( @pytest.mark.parametrize(
"index,param", 'index,param',
[ [
(data.phys_out, "normal"), (data.phys_out, 'normal'),
(data.phys_out, "amix"), (data.phys_out, 'amix'),
(data.phys_out, "rearonly"), (data.phys_out, 'rearonly'),
(data.virt_out, "normal"), (data.virt_out, 'normal'),
(data.virt_out, "upmix41"), (data.virt_out, 'upmix41'),
(data.virt_out, "composite"), (data.virt_out, 'composite'),
], ],
) )
def test_it_sets_and_gets_busmode_bool_params(self, index, param, value): def test_it_sets_and_gets_busmode_bool_params(self, index, param, value):
@ -109,8 +108,8 @@ class TestSetAndGetBoolHigher:
""" macrobutton tests """ """ macrobutton tests """
@pytest.mark.parametrize( @pytest.mark.parametrize(
"index,param", 'index,param',
[(data.button_lower, "state"), (data.button_upper, "trigger")], [(data.button_lower, 'state'), (data.button_upper, 'trigger')],
) )
def test_it_sets_and_gets_macrobutton_bool_params(self, index, param, value): def test_it_sets_and_gets_macrobutton_bool_params(self, index, param, value):
setattr(vm.button[index], param, value) setattr(vm.button[index], param, value)
@ -119,8 +118,8 @@ class TestSetAndGetBoolHigher:
""" vban instream tests """ """ vban instream tests """
@pytest.mark.parametrize( @pytest.mark.parametrize(
"index,param", 'index,param',
[(data.vban_in, "on")], [(data.vban_in, 'on')],
) )
def test_it_sets_and_gets_vban_instream_bool_params(self, index, param, value): def test_it_sets_and_gets_vban_instream_bool_params(self, index, param, value):
setattr(vm.vban.instream[index], param, value) setattr(vm.vban.instream[index], param, value)
@ -129,8 +128,8 @@ class TestSetAndGetBoolHigher:
""" vban outstream tests """ """ vban outstream tests """
@pytest.mark.parametrize( @pytest.mark.parametrize(
"index,param", 'index,param',
[(data.vban_out, "on")], [(data.vban_out, 'on')],
) )
def test_it_sets_and_gets_vban_outstream_bool_params(self, index, param, value): def test_it_sets_and_gets_vban_outstream_bool_params(self, index, param, value):
setattr(vm.vban.outstream[index], param, value) setattr(vm.vban.outstream[index], param, value)
@ -139,8 +138,8 @@ class TestSetAndGetBoolHigher:
""" command tests """ """ command tests """
@pytest.mark.parametrize( @pytest.mark.parametrize(
"param", 'param',
[("lock")], [('lock')],
) )
def test_it_sets_command_bool_params(self, param, value): def test_it_sets_command_bool_params(self, param, value):
setattr(vm.command, param, value) setattr(vm.command, param, value)
@ -148,12 +147,12 @@ class TestSetAndGetBoolHigher:
""" recorder tests """ """ recorder tests """
@pytest.mark.skipif( @pytest.mark.skipif(
data.name == "basic", data.name == 'basic',
reason="Skip test if kind is basic", reason='Skip test if kind is basic',
) )
@pytest.mark.parametrize( @pytest.mark.parametrize(
"param", 'param',
[("A1"), ("B2")], [('A1'), ('B2')],
) )
def test_it_sets_and_gets_recorder_bool_params(self, param, value): def test_it_sets_and_gets_recorder_bool_params(self, param, value):
assert hasattr(vm.recorder, param) assert hasattr(vm.recorder, param)
@ -161,12 +160,12 @@ class TestSetAndGetBoolHigher:
assert getattr(vm.recorder, param) == value assert getattr(vm.recorder, param) == value
@pytest.mark.skipif( @pytest.mark.skipif(
data.name == "basic", data.name == 'basic',
reason="Skip test if kind is basic", reason='Skip test if kind is basic',
) )
@pytest.mark.parametrize( @pytest.mark.parametrize(
"param", 'param',
[("loop")], [('loop')],
) )
def test_it_sets_recorder_bool_params(self, param, value): def test_it_sets_recorder_bool_params(self, param, value):
assert hasattr(vm.recorder, param) assert hasattr(vm.recorder, param)
@ -176,12 +175,12 @@ class TestSetAndGetBoolHigher:
""" recoder.mode tests """ """ recoder.mode tests """
@pytest.mark.skipif( @pytest.mark.skipif(
data.name == "basic", data.name == 'basic',
reason="Skip test if kind is basic", reason='Skip test if kind is basic',
) )
@pytest.mark.parametrize( @pytest.mark.parametrize(
"param", 'param',
[("loop"), ("recbus")], [('loop'), ('recbus')],
) )
def test_it_sets_recorder_mode_bool_params(self, param, value): def test_it_sets_recorder_mode_bool_params(self, param, value):
assert hasattr(vm.recorder.mode, param) assert hasattr(vm.recorder.mode, param)
@ -191,11 +190,11 @@ class TestSetAndGetBoolHigher:
""" recorder.armstrip """ """ recorder.armstrip """
@pytest.mark.skipif( @pytest.mark.skipif(
data.name == "basic", data.name == 'basic',
reason="Skip test if kind is basic", reason='Skip test if kind is basic',
) )
@pytest.mark.parametrize( @pytest.mark.parametrize(
"index", 'index',
[ [
(data.phys_out), (data.phys_out),
(data.virt_out), (data.virt_out),
@ -207,11 +206,11 @@ class TestSetAndGetBoolHigher:
""" recorder.armbus """ """ recorder.armbus """
@pytest.mark.skipif( @pytest.mark.skipif(
data.name == "basic", data.name == 'basic',
reason="Skip test if kind is basic", reason='Skip test if kind is basic',
) )
@pytest.mark.parametrize( @pytest.mark.parametrize(
"index", 'index',
[ [
(data.phys_out), (data.phys_out),
(data.virt_out), (data.virt_out),
@ -223,12 +222,12 @@ class TestSetAndGetBoolHigher:
""" fx tests """ """ fx tests """
@pytest.mark.skipif( @pytest.mark.skipif(
data.name != "potato", data.name != 'potato',
reason="Skip test if kind is not potato", reason='Skip test if kind is not potato',
) )
@pytest.mark.parametrize( @pytest.mark.parametrize(
"param", 'param',
[("reverb"), ("reverb_ab"), ("delay"), ("delay_ab")], [('reverb'), ('reverb_ab'), ('delay'), ('delay_ab')],
) )
def test_it_sets_and_gets_fx_bool_params(self, param, value): def test_it_sets_and_gets_fx_bool_params(self, param, value):
setattr(vm.fx, param, value) setattr(vm.fx, param, value)
@ -237,12 +236,12 @@ class TestSetAndGetBoolHigher:
""" patch tests """ """ patch tests """
@pytest.mark.skipif( @pytest.mark.skipif(
data.name == "basic", data.name == 'basic',
reason="Skip test if kind is basic", reason='Skip test if kind is basic',
) )
@pytest.mark.parametrize( @pytest.mark.parametrize(
"param", 'param',
[("postfadercomposite")], [('postfadercomposite')],
) )
def test_it_sets_and_gets_patch_bool_params(self, param, value): def test_it_sets_and_gets_patch_bool_params(self, param, value):
setattr(vm.patch, param, value) setattr(vm.patch, param, value)
@ -251,12 +250,12 @@ class TestSetAndGetBoolHigher:
""" patch.insert tests """ """ patch.insert tests """
@pytest.mark.skipif( @pytest.mark.skipif(
data.name == "basic", data.name == 'basic',
reason="Skip test if kind is basic", reason='Skip test if kind is basic',
) )
@pytest.mark.parametrize( @pytest.mark.parametrize(
"index, param", 'index, param',
[(data.insert_lower, "on"), (data.insert_higher, "on")], [(data.insert_lower, 'on'), (data.insert_higher, 'on')],
) )
def test_it_sets_and_gets_patch_insert_bool_params(self, index, param, value): def test_it_sets_and_gets_patch_insert_bool_params(self, index, param, value):
setattr(vm.patch.insert[index], param, value) setattr(vm.patch.insert[index], param, value)
@ -265,8 +264,8 @@ class TestSetAndGetBoolHigher:
""" option tests """ """ option tests """
@pytest.mark.parametrize( @pytest.mark.parametrize(
"param", 'param',
[("monitoronsel")], [('monitoronsel')],
) )
def test_it_sets_and_gets_option_bool_params(self, param, value): def test_it_sets_and_gets_option_bool_params(self, param, value):
setattr(vm.option, param, value) setattr(vm.option, param, value)
@ -279,36 +278,49 @@ class TestSetAndGetIntHigher:
"""strip tests, physical and virtual""" """strip tests, physical and virtual"""
@pytest.mark.parametrize( @pytest.mark.parametrize(
"index,param,value", 'index,param,value',
[ [
(data.phys_in, "limit", -40), (data.phys_in, 'limit', -40),
(data.phys_in, "limit", 12), (data.phys_in, 'limit', 12),
(data.virt_in, "k", 0), (data.virt_in - 1, 'k', 0),
(data.virt_in, "k", 4), (data.virt_in - 1, 'k', 4),
], ],
) )
def test_it_sets_and_gets_strip_bool_params(self, index, param, value): def test_it_sets_and_gets_strip_int_params(self, index, param, value):
setattr(vm.strip[index], param, value) setattr(vm.strip[index], param, value)
assert getattr(vm.strip[index], param) == value assert getattr(vm.strip[index], param) == value
""" bus tests, physical """
@pytest.mark.parametrize(
'index,param,value',
[
(data.phys_out, 'mono', 0),
(data.phys_out, 'mono', 2),
],
)
def test_it_sets_and_gets_bus_int_params(self, index, param, value):
setattr(vm.bus[index], param, value)
assert getattr(vm.bus[index], param) == value
""" vban outstream tests """ """ vban outstream tests """
@pytest.mark.parametrize( @pytest.mark.parametrize(
"index,param,value", 'index,param,value',
[(data.vban_out, "sr", 48000)], [(data.vban_out, 'sr', 48000)],
) )
def test_it_sets_and_gets_vban_outstream_bool_params(self, index, param, value): def test_it_sets_and_gets_vban_outstream_int_params(self, index, param, value):
setattr(vm.vban.outstream[index], param, value) setattr(vm.vban.outstream[index], param, value)
assert getattr(vm.vban.outstream[index], param) == value assert getattr(vm.vban.outstream[index], param) == value
""" patch.asio tests """ """ patch.asio tests """
@pytest.mark.skipif( @pytest.mark.skipif(
data.name == "basic", data.name == 'basic',
reason="Skip test if kind is basic", reason='Skip test if kind is basic',
) )
@pytest.mark.parametrize( @pytest.mark.parametrize(
"index,value", 'index,value',
[ [
(0, 1), (0, 1),
(data.asio_in, 4), (data.asio_in, 4),
@ -321,11 +333,11 @@ class TestSetAndGetIntHigher:
""" patch.A2[i]-A5[i] tests """ """ patch.A2[i]-A5[i] tests """
@pytest.mark.skipif( @pytest.mark.skipif(
data.name == "basic", data.name == 'basic',
reason="Skip test if kind is basic", reason='Skip test if kind is basic',
) )
@pytest.mark.parametrize( @pytest.mark.parametrize(
"index,value", 'index,value',
[ [
(0, 1), (0, 1),
(data.asio_out, 4), (data.asio_out, 4),
@ -340,11 +352,11 @@ class TestSetAndGetIntHigher:
""" patch.composite tests """ """ patch.composite tests """
@pytest.mark.skipif( @pytest.mark.skipif(
data.name == "basic", data.name == 'basic',
reason="Skip test if kind is basic", reason='Skip test if kind is basic',
) )
@pytest.mark.parametrize( @pytest.mark.parametrize(
"index,value", 'index,value',
[ [
(0, 3), (0, 3),
(0, data.channels), (0, data.channels),
@ -359,11 +371,11 @@ class TestSetAndGetIntHigher:
""" option tests """ """ option tests """
@pytest.mark.skipif( @pytest.mark.skipif(
data.name == "basic", data.name == 'basic',
reason="Skip test if kind is basic", reason='Skip test if kind is basic',
) )
@pytest.mark.parametrize( @pytest.mark.parametrize(
"index,value", 'index,value',
[ [
(data.phys_out, 30), (data.phys_out, 30),
(data.phys_out, 500), (data.phys_out, 500),
@ -376,16 +388,16 @@ class TestSetAndGetIntHigher:
""" recorder tests """ """ recorder tests """
@pytest.mark.skipif( @pytest.mark.skipif(
data.name == "basic", data.name == 'basic',
reason="Skip test if kind is basic", reason='Skip test if kind is basic',
) )
@pytest.mark.parametrize( @pytest.mark.parametrize(
"param,value", 'param,value',
[ [
("samplerate", 32000), ('samplerate', 32000),
("samplerate", 96000), ('samplerate', 96000),
("bitresolution", 16), ('bitresolution', 16),
("bitresolution", 32), ('bitresolution', 32),
], ],
) )
def test_it_sets_and_gets_recorder_int_params(self, param, value): def test_it_sets_and_gets_recorder_int_params(self, param, value):
@ -400,10 +412,10 @@ class TestSetAndGetFloatHigher:
"""strip tests, physical and virtual""" """strip tests, physical and virtual"""
@pytest.mark.parametrize( @pytest.mark.parametrize(
"index,param,value", 'index,param,value',
[ [
(data.phys_in, "gain", -3.6), (data.phys_in, 'gain', -3.6),
(data.virt_in, "gain", 5.8), (data.virt_in, 'gain', 5.8),
], ],
) )
def test_it_sets_and_gets_strip_float_params(self, index, param, value): def test_it_sets_and_gets_strip_float_params(self, index, param, value):
@ -411,25 +423,25 @@ class TestSetAndGetFloatHigher:
assert getattr(vm.strip[index], param) == value assert getattr(vm.strip[index], param) == value
@pytest.mark.parametrize( @pytest.mark.parametrize(
"index,value", 'index,value',
[(data.phys_in, 2), (data.phys_in, 2), (data.virt_in, 8), (data.virt_in, 8)], [(data.phys_in, 2), (data.phys_in, 2), (data.virt_in, 8), (data.virt_in, 8)],
) )
def test_it_gets_prefader_levels_and_compares_length_of_array(self, index, value): def test_it_gets_prefader_levels_and_compares_length_of_array(self, index, value):
assert len(vm.strip[index].levels.prefader) == value assert len(vm.strip[index].levels.prefader) == value
@pytest.mark.parametrize( @pytest.mark.parametrize(
"index,value", 'index,value',
[(data.phys_in, 2), (data.phys_in, 2), (data.virt_in, 8), (data.virt_in, 8)], [(data.phys_in, 2), (data.phys_in, 2), (data.virt_in, 8), (data.virt_in, 8)],
) )
def test_it_gets_postmute_levels_and_compares_length_of_array(self, index, value): def test_it_gets_postmute_levels_and_compares_length_of_array(self, index, value):
assert len(vm.strip[index].levels.postmute) == value assert len(vm.strip[index].levels.postmute) == value
@pytest.mark.skipif( @pytest.mark.skipif(
data.name != "potato", data.name != 'potato',
reason="Only test if logged into Potato version", reason='Only test if logged into Potato version',
) )
@pytest.mark.parametrize( @pytest.mark.parametrize(
"index, j, value", 'index, j, value',
[ [
(data.phys_in, 0, -20.7), (data.phys_in, 0, -20.7),
(data.virt_in, 3, -60), (data.virt_in, 3, -60),
@ -444,12 +456,12 @@ class TestSetAndGetFloatHigher:
""" strip tests, physical """ """ strip tests, physical """
@pytest.mark.parametrize( @pytest.mark.parametrize(
"index, param, value", 'index, param, value',
[ [
(data.phys_in, "pan_x", -0.6), (data.phys_in, 'pan_x', -0.6),
(data.phys_in, "pan_x", 0.6), (data.phys_in, 'pan_x', 0.6),
(data.phys_in, "color_y", 0.8), (data.phys_in, 'color_y', 0.8),
(data.phys_in, "fx_x", -0.6), (data.phys_in, 'fx_x', -0.6),
], ],
) )
def test_it_sets_and_gets_strip_xy_params(self, index, param, value): def test_it_sets_and_gets_strip_xy_params(self, index, param, value):
@ -458,14 +470,14 @@ class TestSetAndGetFloatHigher:
assert getattr(vm.strip[index], param) == value assert getattr(vm.strip[index], param) == value
@pytest.mark.skipif( @pytest.mark.skipif(
data.name != "potato", data.name != 'potato',
reason="Only test if logged into Potato version", reason='Only test if logged into Potato version',
) )
@pytest.mark.parametrize( @pytest.mark.parametrize(
"index, param, value", 'index, param, value',
[ [
(data.phys_in, "reverb", -1.6), (data.phys_in, 'reverb', -1.6),
(data.phys_in, "postfx1", True), (data.phys_in, 'postfx1', True),
], ],
) )
def test_it_sets_and_gets_strip_effects_params(self, index, param, value): def test_it_sets_and_gets_strip_effects_params(self, index, param, value):
@ -474,14 +486,14 @@ class TestSetAndGetFloatHigher:
assert getattr(vm.strip[index], param) == value assert getattr(vm.strip[index], param) == value
@pytest.mark.skipif( @pytest.mark.skipif(
data.name != "potato", data.name != 'potato',
reason="Only test if logged into Potato version", reason='Only test if logged into Potato version',
) )
@pytest.mark.parametrize( @pytest.mark.parametrize(
"index, param, value", 'index, param, value',
[ [
(data.phys_in, "gainin", -8.6), (data.phys_in, 'gainin', -8.6),
(data.phys_in, "knee", 0.5), (data.phys_in, 'knee', 0.5),
], ],
) )
def test_it_sets_and_gets_strip_comp_params(self, index, param, value): def test_it_sets_and_gets_strip_comp_params(self, index, param, value):
@ -490,14 +502,14 @@ class TestSetAndGetFloatHigher:
assert getattr(vm.strip[index].comp, param) == value assert getattr(vm.strip[index].comp, param) == value
@pytest.mark.skipif( @pytest.mark.skipif(
data.name != "potato", data.name != 'potato',
reason="Only test if logged into Potato version", reason='Only test if logged into Potato version',
) )
@pytest.mark.parametrize( @pytest.mark.parametrize(
"index, param, value", 'index, param, value',
[ [
(data.phys_in, "bpsidechain", 120), (data.phys_in, 'bpsidechain', 120),
(data.phys_in, "hold", 3000), (data.phys_in, 'hold', 3000),
], ],
) )
def test_it_sets_and_gets_strip_gate_params(self, index, param, value): def test_it_sets_and_gets_strip_gate_params(self, index, param, value):
@ -506,13 +518,13 @@ class TestSetAndGetFloatHigher:
assert getattr(vm.strip[index].gate, param) == value assert getattr(vm.strip[index].gate, param) == value
@pytest.mark.skipif( @pytest.mark.skipif(
data.name != "potato", data.name != 'potato',
reason="Only test if logged into Potato version", reason='Only test if logged into Potato version',
) )
@pytest.mark.parametrize( @pytest.mark.parametrize(
"index, param, value", 'index, param, value',
[ [
(data.phys_in, "knob", -8.6), (data.phys_in, 'knob', -8.6),
], ],
) )
def test_it_sets_and_gets_strip_denoiser_params(self, index, param, value): def test_it_sets_and_gets_strip_denoiser_params(self, index, param, value):
@ -522,13 +534,13 @@ class TestSetAndGetFloatHigher:
""" strip tests, virtual """ """ strip tests, virtual """
@pytest.mark.parametrize( @pytest.mark.parametrize(
"index, param, value", 'index, param, value',
[ [
(data.virt_in, "pan_x", -0.6), (data.virt_in, 'pan_x', -0.6),
(data.virt_in, "pan_x", 0.6), (data.virt_in, 'pan_x', 0.6),
(data.virt_in, "treble", -1.6), (data.virt_in, 'treble', -1.6),
(data.virt_in, "mid", 5.8), (data.virt_in, 'mid', 5.8),
(data.virt_in, "bass", -8.1), (data.virt_in, 'bass', -8.1),
], ],
) )
def test_it_sets_and_gets_strip_eq_params(self, index, param, value): def test_it_sets_and_gets_strip_eq_params(self, index, param, value):
@ -538,12 +550,12 @@ class TestSetAndGetFloatHigher:
""" bus tests, physical and virtual """ """ bus tests, physical and virtual """
@pytest.mark.skipif( @pytest.mark.skipif(
data.name != "potato", data.name != 'potato',
reason="Only test if logged into Potato version", reason='Only test if logged into Potato version',
) )
@pytest.mark.parametrize( @pytest.mark.parametrize(
"index, param, value", 'index, param, value',
[(data.phys_out, "returnreverb", 3.6), (data.virt_out, "returnfx1", 5.8)], [(data.phys_out, 'returnreverb', 3.6), (data.virt_out, 'returnfx1', 5.8)],
) )
def test_it_sets_and_gets_bus_effects_float_params(self, index, param, value): def test_it_sets_and_gets_bus_effects_float_params(self, index, param, value):
assert hasattr(vm.bus[index], param) assert hasattr(vm.bus[index], param)
@ -551,30 +563,30 @@ class TestSetAndGetFloatHigher:
assert getattr(vm.bus[index], param) == value assert getattr(vm.bus[index], param) == value
@pytest.mark.parametrize( @pytest.mark.parametrize(
"index, param, value", 'index, param, value',
[(data.phys_out, "gain", -3.6), (data.virt_out, "gain", 5.8)], [(data.phys_out, 'gain', -3.6), (data.virt_out, 'gain', 5.8)],
) )
def test_it_sets_and_gets_bus_float_params(self, index, param, value): def test_it_sets_and_gets_bus_float_params(self, index, param, value):
setattr(vm.bus[index], param, value) setattr(vm.bus[index], param, value)
assert getattr(vm.bus[index], param) == value assert getattr(vm.bus[index], param) == value
@pytest.mark.parametrize( @pytest.mark.parametrize(
"index,value", 'index,value',
[(data.phys_out, 8), (data.virt_out, 8)], [(data.phys_out, 8), (data.virt_out, 8)],
) )
def test_it_gets_prefader_levels_and_compares_length_of_array(self, index, value): def test_it_gets_bus_levels_and_compares_length_of_array(self, index, value):
assert len(vm.bus[index].levels.all) == value assert len(vm.bus[index].levels.all) == value
@pytest.mark.parametrize("value", ["test0", "test1"]) @pytest.mark.parametrize('value', ['test0', 'test1'])
class TestSetAndGetStringHigher: class TestSetAndGetStringHigher:
__test__ = True __test__ = True
"""strip tests, physical and virtual""" """strip tests, physical and virtual"""
@pytest.mark.parametrize( @pytest.mark.parametrize(
"index, param", 'index, param',
[(data.phys_in, "label"), (data.virt_in, "label")], [(data.phys_in, 'label'), (data.virt_in, 'label')],
) )
def test_it_sets_and_gets_strip_string_params(self, index, param, value): def test_it_sets_and_gets_strip_string_params(self, index, param, value):
setattr(vm.strip[index], param, value) setattr(vm.strip[index], param, value)
@ -583,8 +595,8 @@ class TestSetAndGetStringHigher:
""" bus tests, physical and virtual """ """ bus tests, physical and virtual """
@pytest.mark.parametrize( @pytest.mark.parametrize(
"index, param", 'index, param',
[(data.phys_out, "label"), (data.virt_out, "label")], [(data.phys_out, 'label'), (data.virt_out, 'label')],
) )
def test_it_sets_and_gets_bus_string_params(self, index, param, value): def test_it_sets_and_gets_bus_string_params(self, index, param, value):
setattr(vm.bus[index], param, value) setattr(vm.bus[index], param, value)
@ -593,8 +605,8 @@ class TestSetAndGetStringHigher:
""" vban instream tests """ """ vban instream tests """
@pytest.mark.parametrize( @pytest.mark.parametrize(
"index, param", 'index, param',
[(data.vban_in, "name")], [(data.vban_in, 'name')],
) )
def test_it_sets_and_gets_vban_instream_string_params(self, index, param, value): def test_it_sets_and_gets_vban_instream_string_params(self, index, param, value):
setattr(vm.vban.instream[index], param, value) setattr(vm.vban.instream[index], param, value)
@ -603,29 +615,29 @@ class TestSetAndGetStringHigher:
""" vban outstream tests """ """ vban outstream tests """
@pytest.mark.parametrize( @pytest.mark.parametrize(
"index, param", 'index, param',
[(data.vban_out, "name")], [(data.vban_out, 'name')],
) )
def test_it_sets_and_gets_vban_outstream_string_params(self, index, param, value): def test_it_sets_and_gets_vban_outstream_string_params(self, index, param, value):
setattr(vm.vban.outstream[index], param, value) setattr(vm.vban.outstream[index], param, value)
assert getattr(vm.vban.outstream[index], param) == value assert getattr(vm.vban.outstream[index], param) == value
@pytest.mark.parametrize("value", [False, True]) @pytest.mark.parametrize('value', [False, True])
class TestSetAndGetMacroButtonHigher: class TestSetAndGetMacroButtonHigher:
__test__ = True __test__ = True
"""macrobutton tests""" """macrobutton tests"""
@pytest.mark.parametrize( @pytest.mark.parametrize(
"index, param", 'index, param',
[ [
(0, "state"), (0, 'state'),
(39, "stateonly"), (39, 'stateonly'),
(69, "trigger"), (69, 'trigger'),
(22, "stateonly"), (22, 'stateonly'),
(45, "state"), (45, 'state'),
(65, "trigger"), (65, 'trigger'),
], ],
) )
def test_it_sets_and_gets_macrobutton_params(self, index, param, value): def test_it_sets_and_gets_macrobutton_params(self, index, param, value):

View File

@ -9,12 +9,12 @@ class TestSetAndGetFloatLower:
"""VBVMR_SetParameterFloat, VBVMR_GetParameterFloat""" """VBVMR_SetParameterFloat, VBVMR_GetParameterFloat"""
@pytest.mark.parametrize( @pytest.mark.parametrize(
"param,value", 'param,value',
[ [
(f"Strip[{data.phys_in}].Mute", 1), (f'Strip[{data.phys_in}].Mute', 1),
(f"Bus[{data.virt_out}].Eq.on", 1), (f'Bus[{data.virt_out}].Eq.on', 1),
(f"Strip[{data.phys_in}].Mute", 0), (f'Strip[{data.phys_in}].Mute', 0),
(f"Bus[{data.virt_out}].Eq.on", 0), (f'Bus[{data.virt_out}].Eq.on', 0),
], ],
) )
def test_it_sets_and_gets_mute_eq_float_params(self, param, value): def test_it_sets_and_gets_mute_eq_float_params(self, param, value):
@ -22,11 +22,11 @@ class TestSetAndGetFloatLower:
assert (round(vm.get(param))) == value assert (round(vm.get(param))) == value
@pytest.mark.parametrize( @pytest.mark.parametrize(
"param,value", 'param,value',
[ [
(f"Strip[{data.phys_in}].Comp", 5.3), (f'Strip[{data.phys_in}].Comp', 5.3),
(f"Strip[{data.virt_in}].Gain", -37.5), (f'Strip[{data.virt_in}].Gain', -37.5),
(f"Bus[{data.virt_out}].Gain", -22.7), (f'Bus[{data.virt_out}].Gain', -22.7),
], ],
) )
def test_it_sets_and_gets_comp_gain_float_params(self, param, value): def test_it_sets_and_gets_comp_gain_float_params(self, param, value):
@ -34,29 +34,29 @@ class TestSetAndGetFloatLower:
assert (round(vm.get(param), 1)) == value assert (round(vm.get(param), 1)) == value
@pytest.mark.parametrize("value", ["test0", "test1"]) @pytest.mark.parametrize('value', ['test0', 'test1'])
class TestSetAndGetStringLower: class TestSetAndGetStringLower:
__test__ = True __test__ = True
"""VBVMR_SetParameterStringW, VBVMR_GetParameterStringW""" """VBVMR_SetParameterStringW, VBVMR_GetParameterStringW"""
@pytest.mark.parametrize( @pytest.mark.parametrize(
"param", 'param',
[(f"Strip[{data.phys_out}].label"), (f"Bus[{data.virt_out}].label")], [(f'Strip[{data.phys_out}].label'), (f'Bus[{data.virt_out}].label')],
) )
def test_it_sets_and_gets_string_params(self, param, value): def test_it_sets_and_gets_string_params(self, param, value):
vm.set(param, value) vm.set(param, value)
assert vm.get(param, string=True) == value assert vm.get(param, string=True) == value
@pytest.mark.parametrize("value", [0, 1]) @pytest.mark.parametrize('value', [0, 1])
class TestMacroButtonsLower: class TestMacroButtonsLower:
__test__ = True __test__ = True
"""VBVMR_MacroButton_SetStatus, VBVMR_MacroButton_GetStatus""" """VBVMR_MacroButton_SetStatus, VBVMR_MacroButton_GetStatus"""
@pytest.mark.parametrize( @pytest.mark.parametrize(
"index, mode", 'index, mode',
[(33, 1), (49, 1)], [(33, 1), (49, 1)],
) )
def test_it_sets_and_gets_macrobuttons_state(self, index, mode, value): def test_it_sets_and_gets_macrobuttons_state(self, index, mode, value):
@ -64,7 +64,7 @@ class TestMacroButtonsLower:
assert vm.get_buttonstatus(index, mode) == value assert vm.get_buttonstatus(index, mode) == value
@pytest.mark.parametrize( @pytest.mark.parametrize(
"index, mode", 'index, mode',
[(14, 2), (12, 2)], [(14, 2), (12, 2)],
) )
def test_it_sets_and_gets_macrobuttons_stateonly(self, index, mode, value): def test_it_sets_and_gets_macrobuttons_stateonly(self, index, mode, value):
@ -72,7 +72,7 @@ class TestMacroButtonsLower:
assert vm.get_buttonstatus(index, mode) == value assert vm.get_buttonstatus(index, mode) == value
@pytest.mark.parametrize( @pytest.mark.parametrize(
"index, mode", 'index, mode',
[(50, 3), (65, 3)], [(50, 3), (65, 3)],
) )
def test_it_sets_and_gets_macrobuttons_trigger(self, index, mode, value): def test_it_sets_and_gets_macrobuttons_trigger(self, index, mode, value):

View File

@ -39,12 +39,12 @@ class Bus(IRemote):
self.setter('mute', 1 if val else 0) self.setter('mute', 1 if val else 0)
@property @property
def mono(self) -> bool: def mono(self) -> int:
return self.getter('mono') == 1 return int(self.getter('mono'))
@mono.setter @mono.setter
def mono(self, val: bool): def mono(self, val: int):
self.setter('mono', 1 if val else 0) self.setter('mono', val)
@property @property
def sel(self) -> bool: def sel(self) -> bool: