From c9c365ac547f316130e6b4a19463ebdf26ec0fa4 Mon Sep 17 00:00:00 2001 From: Onyx and Iris Date: Sat, 25 Jan 2025 02:00:54 +0000 Subject: [PATCH] rename test poe scripts add passenv = * to [testenv] --- pyproject.toml | 9 +++++---- scripts.py | 9 +++------ tests/__init__.py | 7 ++----- 3 files changed, 10 insertions(+), 15 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index e7738aa..0ce2b6d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -30,10 +30,10 @@ build-backend = "poetry.core.masonry.api" gui.script = "scripts:ex_gui" 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 = """ @@ -41,6 +41,7 @@ legacy_tox_ini = """ envlist = py310,py311,py312 [testenv] +passenv = * setenv = VIRTUALENV_DISCOVERY=pyenv allowlist_externals = poetry commands = diff --git a/scripts.py b/scripts.py index 7939804..dcf4a91 100644 --- a/scripts.py +++ b/scripts.py @@ -19,18 +19,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 7801fb3..7b7eb36 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -7,16 +7,13 @@ import vban_cmd from vban_cmd.kinds import KindId from vban_cmd.kinds import request_kind_map as kindmap -# 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') opts = { 'ip': 'localhost', 'streamname': 'onyx', 'port': 6980, - 'bps': 0, } vban = vban_cmd.api(KIND_ID, **opts)