mirror of
https://github.com/onyx-and-iris/xair-api-python.git
synced 2024-11-15 17:40:57 +00:00
move xair tests into tests.xair package
This commit is contained in:
parent
a69734b738
commit
079d1b308d
@ -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()
|
|
@ -1 +1 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="60" height="20" role="img" aria-label="tests: 67"><title>tests: 67</title><linearGradient id="s" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="r"><rect width="60" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#r)"><rect width="37" height="20" fill="#555"/><rect x="37" width="23" height="20" fill="#4c1"/><rect width="60" height="20" fill="url(#s)"/></g><g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"><text aria-hidden="true" x="195" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="270">tests</text><text x="195" y="140" transform="scale(.1)" fill="#fff" textLength="270">tests</text><text aria-hidden="true" x="475" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="130">67</text><text x="475" y="140" transform="scale(.1)" fill="#fff" textLength="130">67</text></g></svg>
|
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="60" height="20" role="img" aria-label="tests: 75"><title>tests: 75</title><linearGradient id="s" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="r"><rect width="60" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#r)"><rect width="37" height="20" fill="#555"/><rect x="37" width="23" height="20" fill="#4c1"/><rect width="60" height="20" fill="url(#s)"/></g><g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"><text aria-hidden="true" x="195" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="270">tests</text><text x="195" y="140" transform="scale(.1)" fill="#fff" textLength="270">tests</text><text aria-hidden="true" x="475" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="130">75</text><text x="475" y="140" transform="scale(.1)" fill="#fff" textLength="130">75</text></g></svg>
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
39
tests/xair/__init__.py
Normal file
39
tests/xair/__init__.py
Normal file
@ -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()
|
@ -1,6 +1,7 @@
|
|||||||
Function RunTests {
|
Function RunTests {
|
||||||
$coverage = "./tests/pytest_coverage.log"
|
"Running tests in directory $PSScriptRoot" | Write-Host
|
||||||
$run_tests = "pytest -v --capture=tee-sys --junitxml=./tests/.coverage.xml"
|
$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"
|
$match_pattern = "^=|^\s*$|^Running|^Using|^plugins|^collecting|^tests"
|
||||||
|
|
||||||
if ( Test-Path $coverage ) { Clear-Content $coverage }
|
if ( Test-Path $coverage ) { Clear-Content $coverage }
|
||||||
@ -13,7 +14,7 @@ Function RunTests {
|
|||||||
}
|
}
|
||||||
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 $(Join-Path $PSScriptRoot ".coverage.xml") -o $(Join-Path $PSScriptRoot "$kind.svg")"
|
||||||
}
|
}
|
||||||
|
|
||||||
Function Get-TimeStamp {
|
Function Get-TimeStamp {
|
@ -1,6 +1,6 @@
|
|||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from tests import data, tests
|
from tests.xair import data, tests
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Not every subclass is tested for every superclass to avoid redundancy.
|
Not every subclass is tested for every superclass to avoid redundancy.
|
||||||
@ -326,7 +326,7 @@ class TestSetAndGetBusDynHigher:
|
|||||||
assert getattr(self.target, param) == value
|
assert getattr(self.target, param) == value
|
||||||
|
|
||||||
|
|
||||||
class TestSetAndGetBusDynHigher:
|
class TestSetAndGetBusEQHigher:
|
||||||
"""EQ"""
|
"""EQ"""
|
||||||
|
|
||||||
__test__ = True
|
__test__ = True
|
||||||
@ -368,6 +368,6 @@ class TestSetAndGetFXSendGroupHigher:
|
|||||||
"param,value",
|
"param,value",
|
||||||
[("dca", 0), ("dca", 12), ("mute", 3), ("mute", 8)],
|
[("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)
|
setattr(self.target, param, value)
|
||||||
assert getattr(self.target, param) == value
|
assert getattr(self.target, param) == value
|
Loading…
Reference in New Issue
Block a user