add py13 to tox envlist

test_xair and test_x32 now run tests with tox

upd Tests section in README
This commit is contained in:
Onyx and Iris 2025-02-13 11:01:44 +00:00
parent cf4a1d295f
commit 2b91863337
5 changed files with 45 additions and 32 deletions

2
.gitignore vendored
View File

@ -131,5 +131,7 @@ dmypy.json
# config, quick test # config, quick test
config.toml config.toml
quick.py quick.py
tools/*
!tools/README.md
.vscode/ .vscode/

View File

@ -339,14 +339,14 @@ print(mixer.query('/ch/01/mix/on'))
### `Tests` ### `Tests`
Unplug any expensive equipment before running tests. Install [poetry](https://python-poetry.org/docs/#installation) and then:
Save your current settings to a snapshot first.
First make sure you installed the [development dependencies](https://github.com/onyx-and-iris/xair-api-python#installation) ```powershell
poetry poe test-xair
poetry poe test-x32
```
To run all tests: Unplug any expensive equipment and save your current settings to a snapshot first.
`pytest -v`.
## License ## License

View File

@ -31,29 +31,33 @@ build-backend = "poetry.core.masonry.api"
obs.script = "scripts:ex_obs" obs.script = "scripts:ex_obs"
sends.script = "scripts:ex_sends" sends.script = "scripts:ex_sends"
headamp.script = "scripts:ex_headamp" headamp.script = "scripts:ex_headamp"
xair.script = "scripts:test_xair" test-xair.script = "scripts:test_xair"
x32.script = "scripts:test_x32" test-x32.script = "scripts:test_x32"
all.script = "scripts:test_all" test-all.script = "scripts:test_all"
[tool.tox] [tool.tox]
legacy_tox_ini = """ legacy_tox_ini = """
[tox] [tox]
envlist = py310,py311,py312 envlist = py310,py311,py312,py313
[testenv] [testenv]
passenv =
TEST_MODULE
setenv = VIRTUALENV_DISCOVERY=pyenv setenv = VIRTUALENV_DISCOVERY=pyenv
allowlist_externals = poetry allowlist_externals = poetry
commands_pre =
poetry install --no-interaction --no-root
commands = commands =
poetry install -v poetry run pytest tests/{env:TEST_MODULE}
poetry run pytest tests/
[testenv:obs] [testenv:obs]
setenv = VIRTUALENV_DISCOVERY=pyenv setenv = VIRTUALENV_DISCOVERY=pyenv
allowlist_externals = poetry allowlist_externals = poetry
deps = obsws-python deps = obsws-python
commands_pre =
poetry install --no-interaction --no-root --without dev
commands = commands =
poetry install -v --without dev poetry run python examples/xair_obs
poetry run python examples/xair_obs/
""" """
[tool.ruff] [tool.ruff]

View File

@ -1,31 +1,35 @@
import os
import subprocess import subprocess
import sys import sys
from pathlib import Path from pathlib import Path
def ex_obs(): def ex_obs():
subprocess.run(["tox", "r", "-e", "obs"]) subprocess.run(['tox', 'r', '-e', 'obs'])
def ex_sends(): def ex_sends():
path = Path.cwd() / "examples" / "sends" / "." path = Path.cwd() / 'examples' / 'sends' / '.'
subprocess.run([sys.executable, str(path)]) subprocess.run([sys.executable, str(path)])
def ex_headamp(): def ex_headamp():
path = Path.cwd() / "examples" / "headamp" / "." path = Path.cwd() / 'examples' / 'headamp' / '.'
subprocess.run([sys.executable, str(path)]) subprocess.run([sys.executable, str(path)])
def test_xair(): def test_xair():
path = Path.cwd() / "tests" / "xair" subprocess.run(['tox'], env=os.environ.copy() | {'TEST_MODULE': 'xair'})
subprocess.run(["pytest", "-v", str(path)])
def test_x32(): def test_x32():
path = Path.cwd() / "tests" / "x32" path = Path.cwd() / 'tools' / 'x32.exe'
subprocess.run(["pytest", "-v", str(path)]) proc = subprocess.Popen([str(path), '-i', 'x32.local'])
subprocess.run(['tox'], env=os.environ.copy() | {'TEST_MODULE': 'x32'})
proc.terminate()
def test_all(): def test_all():
subprocess.run(["tox"]) steps = [test_xair, test_x32]
for step in steps:
step()

3
tools/README.md Normal file
View File

@ -0,0 +1,3 @@
# X32 Tests
Download the [x32 Emulator](https://sites.google.com/site/patrickmaillot/x32#h.p_rE4IH0Luimc0) and place it in this directory in order to run the x32 tests.