add poetry test scripts for each kind

This commit is contained in:
onyx-and-iris 2023-08-10 16:27:49 +01:00
parent 4a397d8d96
commit cf88b0a63b
4 changed files with 32 additions and 5 deletions

View File

@ -33,7 +33,10 @@ levels = "scripts:ex_levels"
midi = "scripts:ex_midi" midi = "scripts:ex_midi"
obs = "scripts:ex_obs" obs = "scripts:ex_obs"
observer = "scripts:ex_observer" observer = "scripts:ex_observer"
test = "scripts:test" basic = "scripts:test_basic"
banana = "scripts:test_banana"
potato = "scripts:test_potato"
all = "scripts:test_all"
[tool.tox] [tool.tox]
legacy_tox_ini = """ legacy_tox_ini = """

View File

@ -1,3 +1,4 @@
import os
import subprocess import subprocess
import sys import sys
from pathlib import Path from pathlib import Path
@ -38,5 +39,21 @@ def ex_observer():
subprocess.run([sys.executable, str(scriptpath)]) subprocess.run([sys.executable, str(scriptpath)])
def test(): def test_basic():
os.environ["KIND"] = "basic"
subprocess.run(["tox"]) subprocess.run(["tox"])
def test_banana():
os.environ["KIND"] = "banana"
subprocess.run(["tox"])
def test_potato():
os.environ["KIND"] = "potato"
subprocess.run(["tox"])
def test_all():
steps = [test_basic, test_banana, test_potato]
[step() for step in steps]

View File

@ -1,3 +1,4 @@
import os
import random import random
import sys import sys
from dataclasses import dataclass from dataclasses import dataclass
@ -30,8 +31,10 @@ class Data:
return (2 * self.phys_in) + (8 * self.virt_in) return (2 * self.phys_in) + (8 * self.virt_in)
# let's keep things random # get KIND_ID from env var, otherwise set to random
KIND_ID = random.choice(tuple(kind_id.name.lower() for kind_id in KindId)) KIND_ID = os.environ.get(
"KIND", random.choice(tuple(kind_id.name.lower() for kind_id in KindId))
)
vm = voicemeeterlib.api(KIND_ID) vm = voicemeeterlib.api(KIND_ID)
kind = kindmap(KIND_ID) kind = kindmap(KIND_ID)

View File

@ -25,7 +25,11 @@ Function Get-TimeStamp {
if ($MyInvocation.InvocationName -ne ".") { if ($MyInvocation.InvocationName -ne ".") {
Invoke-Expression ".\.venv\Scripts\Activate.ps1" Invoke-Expression ".\.venv\Scripts\Activate.ps1"
@("potato") | ForEach-Object {
$env:KIND = $_
RunTests RunTests
}
Invoke-Expression "deactivate" Invoke-Expression "deactivate"
} }