diff --git a/tests/__init__.py b/tests/__init__.py index 5a7fda0..e69de29 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -1,39 +0,0 @@ -import sys -import threading -from dataclasses import dataclass - -import xair_api -from xair_api import kinds - -kind_id = "MR18" -ip = "mixer.local" - -tests = xair_api.connect(kind_id, ip=ip) - -kind = kinds.get(kind_id) - - -@dataclass -class Data: - """bounds data to map tests to a kind""" - - name: str = kind.id_ - dca: int = kind.num_dca - 1 - strip: int = kind.num_strip - 1 - bus: int = kind.num_bus - 1 - fx: int = kind.num_fx - 1 - - -data = Data() - - -def setup_module(): - print(f"\nRunning tests for kind [{data.name}]\n", file=sys.stdout) - tests.worker = threading.Thread(target=tests.run_server) - tests.worker.daemon = True - tests.worker.start() - tests.validate_connection() - - -def teardown_module(): - tests.server.shutdown() diff --git a/tests/MR18.svg b/tests/xair/MR18.svg similarity index 86% rename from tests/MR18.svg rename to tests/xair/MR18.svg index 08a5179..e3f4d9b 100644 --- a/tests/MR18.svg +++ b/tests/xair/MR18.svg @@ -1 +1 @@ -tests: 67tests67 \ No newline at end of file +tests: 75tests75 \ No newline at end of file diff --git a/tests/xair/__init__.py b/tests/xair/__init__.py new file mode 100644 index 0000000..5a7fda0 --- /dev/null +++ b/tests/xair/__init__.py @@ -0,0 +1,39 @@ +import sys +import threading +from dataclasses import dataclass + +import xair_api +from xair_api import kinds + +kind_id = "MR18" +ip = "mixer.local" + +tests = xair_api.connect(kind_id, ip=ip) + +kind = kinds.get(kind_id) + + +@dataclass +class Data: + """bounds data to map tests to a kind""" + + name: str = kind.id_ + dca: int = kind.num_dca - 1 + strip: int = kind.num_strip - 1 + bus: int = kind.num_bus - 1 + fx: int = kind.num_fx - 1 + + +data = Data() + + +def setup_module(): + print(f"\nRunning tests for kind [{data.name}]\n", file=sys.stdout) + tests.worker = threading.Thread(target=tests.run_server) + tests.worker.daemon = True + tests.worker.start() + tests.validate_connection() + + +def teardown_module(): + tests.server.shutdown() diff --git a/tests/pre-commit.ps1 b/tests/xair/pre-commit.ps1 similarity index 66% rename from tests/pre-commit.ps1 rename to tests/xair/pre-commit.ps1 index de4a602..2af722c 100644 --- a/tests/pre-commit.ps1 +++ b/tests/xair/pre-commit.ps1 @@ -1,6 +1,7 @@ Function RunTests { - $coverage = "./tests/pytest_coverage.log" - $run_tests = "pytest -v --capture=tee-sys --junitxml=./tests/.coverage.xml" + "Running tests in directory $PSScriptRoot" | Write-Host + $coverage = Join-Path $PSScriptRoot "pytest_coverage.log" + $run_tests = "pytest -v $PSScriptRoot --capture=tee-sys --junitxml=$(Join-Path $PSScriptRoot ".coverage.xml")" $match_pattern = "^=|^\s*$|^Running|^Using|^plugins|^collecting|^tests" if ( Test-Path $coverage ) { Clear-Content $coverage } @@ -13,7 +14,7 @@ Function RunTests { } 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 $(Join-Path $PSScriptRoot ".coverage.xml") -o $(Join-Path $PSScriptRoot "$kind.svg")" } Function Get-TimeStamp { diff --git a/tests/test_shared.py b/tests/xair/test_shared.py similarity index 98% rename from tests/test_shared.py rename to tests/xair/test_shared.py index f1dfdc3..e3e0bbb 100644 --- a/tests/test_shared.py +++ b/tests/xair/test_shared.py @@ -1,6 +1,6 @@ import pytest -from tests import data, tests +from tests.xair import data, tests """ Not every subclass is tested for every superclass to avoid redundancy. @@ -326,7 +326,7 @@ class TestSetAndGetBusDynHigher: assert getattr(self.target, param) == value -class TestSetAndGetBusDynHigher: +class TestSetAndGetBusEQHigher: """EQ""" __test__ = True @@ -368,6 +368,6 @@ class TestSetAndGetFXSendGroupHigher: "param,value", [("dca", 0), ("dca", 12), ("mute", 3), ("mute", 8)], ) - def test_it_sets_and_gets_bus_bool_params(self, param, value): + def test_it_sets_and_gets_fxsend_int_params(self, param, value): setattr(self.target, param, value) assert getattr(self.target, param) == value