From b79d9494a2b3987ebda1447edffb5f44cc8ef5bb Mon Sep 17 00:00:00 2001 From: Onyx and Iris Date: Sat, 25 Jan 2025 01:49:18 +0000 Subject: [PATCH] rename test poe scripts add passenv = * to [testenv] --- pyproject.toml | 15 +++++++++------ scripts.py | 9 +++------ tests/__init__.py | 8 +++----- 3 files changed, 15 insertions(+), 17 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index ee5fd68..d0cd19e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -37,10 +37,10 @@ levels.script = "scripts:ex_levels" midi.script = "scripts:ex_midi" obs.script = "scripts:ex_obs" observer.script = "scripts:ex_observer" -basic.script = "scripts:test_basic" -banana.script = "scripts:test_banana" -potato.script = "scripts:test_potato" -all.script = "scripts:test_all" +test_basic.script = "scripts:test_basic" +test_banana.script = "scripts:test_banana" +test_potato.script = "scripts:test_potato" +test_all.script = "scripts:test_all" [tool.tox] legacy_tox_ini = """ @@ -48,6 +48,7 @@ legacy_tox_ini = """ envlist = py310,py311,py312 [testenv] +passenv = * setenv = VIRTUALENV_DISCOVERY=pyenv allowlist_externals = poetry commands = @@ -105,14 +106,16 @@ target-version = "py310" [tool.ruff.lint] # Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`) codes by default. +# Enable flake8-errmsg (EM) warnings. +# Enable flake8-bugbear (B) warnings. # Unlike Flake8, Ruff doesn't enable pycodestyle warnings (`W`) or # McCabe complexity (`C901`) by default. -select = ["E4", "E7", "E9", "F"] +select = ["E4", "E7", "E9", "EM", "F", "B"] ignore = [] # Allow fix for all enabled rules (when `--fix`) is provided. fixable = ["ALL"] -unfixable = [] +unfixable = ["B"] # Allow unused variables when underscore-prefixed. dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$" diff --git a/scripts.py b/scripts.py index 334bd5f..43955c6 100644 --- a/scripts.py +++ b/scripts.py @@ -38,18 +38,15 @@ def ex_observer(): def test_basic(): - os.environ['KIND'] = 'basic' - subprocess.run(['tox']) + subprocess.run(['tox'], env=os.environ.copy() | {'KIND': 'basic'}) def test_banana(): - os.environ['KIND'] = 'banana' - subprocess.run(['tox']) + subprocess.run(['tox'], env=os.environ.copy() | {'KIND': 'banana'}) def test_potato(): - os.environ['KIND'] = 'potato' - subprocess.run(['tox']) + subprocess.run(['tox'], env=os.environ.copy() | {'KIND': 'potato'}) def test_all(): diff --git a/tests/__init__.py b/tests/__init__.py index 64990aa..6c26783 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -31,10 +31,8 @@ class Data: return (2 * self.phys_in) + (8 * self.virt_in) -# get KIND_ID from env var, otherwise set to random -KIND_ID = os.environ.get( - "KIND", random.choice(tuple(kind_id.name.lower() for kind_id in KindId)) -) +# get KIND from environment, if not set default to potato +KIND_ID = os.environ.get('KIND', 'potato') vm = voicemeeterlib.api(KIND_ID) kind = kindmap(KIND_ID) @@ -56,7 +54,7 @@ data = Data( def setup_module(): - print(f"\nRunning tests for kind [{data.name}]\n", file=sys.stdout) + print(f'\nRunning tests for kind [{data.name}]\n', file=sys.stdout) vm.login() vm.command.reset()