mirror of
https://github.com/onyx-and-iris/voicemeeter-api-python.git
synced 2024-11-22 11:00:47 +00:00
fx, xy unit tests added to higher.
add --run-slow flag for pytest in conftest.py run --run-slow in pre-commit call tests.command.reset() before each test run
This commit is contained in:
parent
1a6f3d6c73
commit
312d5847ef
@ -35,6 +35,7 @@ data = Data()
|
|||||||
def setup_module():
|
def setup_module():
|
||||||
print(f"\nRunning tests for kind [{data.name}]\n", file=sys.stdout)
|
print(f"\nRunning tests for kind [{data.name}]\n", file=sys.stdout)
|
||||||
tests.login()
|
tests.login()
|
||||||
|
tests.command.reset()
|
||||||
|
|
||||||
|
|
||||||
def teardown_module():
|
def teardown_module():
|
||||||
|
7
tests/conftest.py
Normal file
7
tests/conftest.py
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
def pytest_addoption(parser):
|
||||||
|
parser.addoption(
|
||||||
|
"--run-slow",
|
||||||
|
action="store_true",
|
||||||
|
default=False,
|
||||||
|
help="Run slow tests",
|
||||||
|
)
|
@ -1,6 +1,6 @@
|
|||||||
Function RunTests {
|
Function RunTests {
|
||||||
$coverage = "./tests/pytest_coverage.log"
|
$coverage = "./tests/pytest_coverage.log"
|
||||||
$run_tests = "pytest -v --capture=tee-sys --junitxml=./tests/.coverage.xml"
|
$run_tests = "pytest --run-slow -v --capture=tee-sys --junitxml=./tests/.coverage.xml"
|
||||||
$match_pattern = "^=|^\s*$|^Running|^Using|^plugins|^collecting|^tests"
|
$match_pattern = "^=|^\s*$|^Running|^Using|^plugins|^collecting|^tests"
|
||||||
|
|
||||||
if ( Test-Path $coverage ) { Clear-Content $coverage }
|
if ( Test-Path $coverage ) { Clear-Content $coverage }
|
||||||
@ -11,7 +11,7 @@ Function RunTests {
|
|||||||
$line | Tee-Object -FilePath $coverage -Append
|
$line | Tee-Object -FilePath $coverage -Append
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Write-Output "$(Get-TimeStamp)" | Out-file $coverage -Append
|
Write-Output "$(Get-TimeStamp)" | Out-File $coverage -Append
|
||||||
|
|
||||||
Invoke-Expression "genbadge tests -t 90 -i ./tests/.coverage.xml -o ./tests/$kind.svg"
|
Invoke-Expression "genbadge tests -t 90 -i ./tests/.coverage.xml -o ./tests/$kind.svg"
|
||||||
}
|
}
|
||||||
|
@ -39,6 +39,27 @@ class TestSetAndGetBoolHigher:
|
|||||||
|
|
||||||
""" bus modes tests, physical and virtual """
|
""" bus modes tests, physical and virtual """
|
||||||
|
|
||||||
|
@pytest.mark.skipif(
|
||||||
|
data.name != "basic",
|
||||||
|
reason="Skip test if kind is not basic",
|
||||||
|
)
|
||||||
|
@pytest.mark.parametrize(
|
||||||
|
"index,param",
|
||||||
|
[
|
||||||
|
(data.phys_out, "normal"),
|
||||||
|
(data.phys_out, "amix"),
|
||||||
|
(data.virt_out, "normal"),
|
||||||
|
(data.virt_out, "composite"),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
def test_it_sets_and_gets_busmode_basic_bool_params(self, index, param, value):
|
||||||
|
setattr(tests.bus[index].mode, param, value)
|
||||||
|
assert getattr(tests.bus[index].mode, param) == value
|
||||||
|
|
||||||
|
@pytest.mark.skipif(
|
||||||
|
data.name == "basic",
|
||||||
|
reason="Skip test if kind is basic",
|
||||||
|
)
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"index,param",
|
"index,param",
|
||||||
[
|
[
|
||||||
@ -50,7 +71,7 @@ class TestSetAndGetBoolHigher:
|
|||||||
(data.virt_out, "composite"),
|
(data.virt_out, "composite"),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
def test_it_sets_and_gets_bus_bool_params(self, index, param, value):
|
def test_it_sets_and_gets_busmode_bool_params(self, index, param, value):
|
||||||
setattr(tests.bus[index].mode, param, value)
|
setattr(tests.bus[index].mode, param, value)
|
||||||
assert getattr(tests.bus[index].mode, param) == value
|
assert getattr(tests.bus[index].mode, param) == value
|
||||||
|
|
||||||
@ -118,6 +139,21 @@ class TestSetAndGetBoolHigher:
|
|||||||
def test_it_sets_recorder_bool_params(self, param, value):
|
def test_it_sets_recorder_bool_params(self, param, value):
|
||||||
setattr(tests.recorder, param, value)
|
setattr(tests.recorder, param, value)
|
||||||
|
|
||||||
|
""" fx tests """
|
||||||
|
|
||||||
|
@pytest.mark.skipif(
|
||||||
|
data.name != "potato",
|
||||||
|
reason="Skip test if kind is basic",
|
||||||
|
)
|
||||||
|
@pytest.mark.parametrize(
|
||||||
|
"param",
|
||||||
|
[("reverb"), ("reverb_ab"), ("delay"), ("delay_ab")],
|
||||||
|
)
|
||||||
|
def test_it_sets_and_gets_fx_bool_params(self, param, value):
|
||||||
|
assert hasattr(tests, "fx")
|
||||||
|
setattr(tests.fx, param, value)
|
||||||
|
assert getattr(tests.fx, param) == value
|
||||||
|
|
||||||
|
|
||||||
class TestSetAndGetIntHigher:
|
class TestSetAndGetIntHigher:
|
||||||
__test__ = True
|
__test__ = True
|
||||||
@ -199,6 +235,38 @@ class TestSetAndGetFloatHigher:
|
|||||||
tests.strip[index].gainlayer[j].gain = value
|
tests.strip[index].gainlayer[j].gain = value
|
||||||
assert tests.strip[index].gainlayer[j].gain == value
|
assert tests.strip[index].gainlayer[j].gain == value
|
||||||
|
|
||||||
|
""" strip tests, physical """
|
||||||
|
|
||||||
|
@pytest.mark.parametrize(
|
||||||
|
"index, param, value",
|
||||||
|
[
|
||||||
|
(data.phys_in, "pan_x", -0.6),
|
||||||
|
(data.phys_in, "pan_x", 0.6),
|
||||||
|
(data.phys_in, "color_y", 0.8),
|
||||||
|
(data.phys_in, "fx_x", -0.6),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
def test_it_sets_and_gets_strip_xy_params(self, index, param, value):
|
||||||
|
assert hasattr(tests.strip[index], param)
|
||||||
|
setattr(tests.strip[index], param, value)
|
||||||
|
assert getattr(tests.strip[index], param) == value
|
||||||
|
|
||||||
|
@pytest.mark.skipif(
|
||||||
|
data.name != "potato",
|
||||||
|
reason="Only test if logged into Potato version",
|
||||||
|
)
|
||||||
|
@pytest.mark.parametrize(
|
||||||
|
"index, param, value",
|
||||||
|
[
|
||||||
|
(data.phys_in, "reverb", -1.6),
|
||||||
|
(data.phys_in, "postfx1", True),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
def test_it_sets_and_gets_strip_effects_params(self, index, param, value):
|
||||||
|
assert hasattr(tests.strip[index], param)
|
||||||
|
setattr(tests.strip[index], param, value)
|
||||||
|
assert getattr(tests.strip[index], param) == value
|
||||||
|
|
||||||
""" strip tests, virtual """
|
""" strip tests, virtual """
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
@ -215,6 +283,19 @@ class TestSetAndGetFloatHigher:
|
|||||||
|
|
||||||
""" bus tests, physical and virtual """
|
""" bus tests, physical and virtual """
|
||||||
|
|
||||||
|
@pytest.mark.skipif(
|
||||||
|
data.name != "potato",
|
||||||
|
reason="Only test if logged into Potato version",
|
||||||
|
)
|
||||||
|
@pytest.mark.parametrize(
|
||||||
|
"index, param, value",
|
||||||
|
[(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):
|
||||||
|
assert hasattr(tests.bus[index], param)
|
||||||
|
setattr(tests.bus[index], param, value)
|
||||||
|
assert getattr(tests.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)],
|
||||||
|
Loading…
Reference in New Issue
Block a user