diff --git a/tests/__init__.py b/tests/__init__.py index 71f98a0..5b6369b 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -35,6 +35,7 @@ data = Data() def setup_module(): print(f"\nRunning tests for kind [{data.name}]\n", file=sys.stdout) tests.login() + tests.command.reset() def teardown_module(): diff --git a/tests/conftest.py b/tests/conftest.py new file mode 100644 index 0000000..92df958 --- /dev/null +++ b/tests/conftest.py @@ -0,0 +1,7 @@ +def pytest_addoption(parser): + parser.addoption( + "--run-slow", + action="store_true", + default=False, + help="Run slow tests", + ) diff --git a/tests/pre-commit.ps1 b/tests/pre-commit.ps1 index 98394ff..ee004ea 100644 --- a/tests/pre-commit.ps1 +++ b/tests/pre-commit.ps1 @@ -1,6 +1,6 @@ Function RunTests { $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" if ( Test-Path $coverage ) { Clear-Content $coverage } @@ -11,7 +11,7 @@ Function RunTests { $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" } diff --git a/tests/test_higher.py b/tests/test_higher.py index 15f3893..8bcd783 100644 --- a/tests/test_higher.py +++ b/tests/test_higher.py @@ -39,6 +39,27 @@ class TestSetAndGetBoolHigher: """ 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( "index,param", [ @@ -50,7 +71,7 @@ class TestSetAndGetBoolHigher: (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) assert getattr(tests.bus[index].mode, param) == value @@ -118,6 +139,21 @@ class TestSetAndGetBoolHigher: def test_it_sets_recorder_bool_params(self, 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: __test__ = True @@ -199,6 +235,38 @@ class TestSetAndGetFloatHigher: 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 """ @pytest.mark.parametrize( @@ -215,6 +283,19 @@ class TestSetAndGetFloatHigher: """ 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( "index, param, value", [(data.phys_out, "gain", -3.6), (data.virt_out, "gain", 5.8)],