From 84334e1b7902ee9beb300b7f112b4f9863df99e2 Mon Sep 17 00:00:00 2001 From: Nanahuse <109294061+Nanahuse@users.noreply.github.com> Date: Sat, 8 Aug 2026 15:22:29 +0900 Subject: [PATCH 1/3] Fix local pytest package imports --- pyproject.toml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 5a5f57f..313356b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -40,5 +40,8 @@ lint.ignore = [ "TD", ] +[tool.pytest.ini_options] +pythonpath = ["."] + [tool.ruff.per-file-ignores] "test/*" = ["INP001", "PLR2004", "SLF001"] From 502e581538c0fddd64acaa59d0eb387acfbe3a02 Mon Sep 17 00:00:00 2001 From: Nanahuse <109294061+Nanahuse@users.noreply.github.com> Date: Sun, 9 Aug 2026 10:11:14 +0900 Subject: [PATCH 2/3] Gate VOICEPEAK integration tests --- pyproject.toml | 3 +++ test/conftest.py | 27 +++++++++++++++++++ ... test_manual_voicepeak_file_generation.py} | 17 +++++++++--- 3 files changed, 44 insertions(+), 3 deletions(-) create mode 100644 test/conftest.py rename test/{manual_voicepeak_file_generation.py => test_manual_voicepeak_file_generation.py} (86%) diff --git a/pyproject.toml b/pyproject.toml index 313356b..3e9511e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -42,6 +42,9 @@ lint.ignore = [ [tool.pytest.ini_options] pythonpath = ["."] +markers = [ + "voicepeak: manual integration tests that require a local VOICEPEAK installation (skipped by default; pass --run-voicepeak-integration)", +] [tool.ruff.per-file-ignores] "test/*" = ["INP001", "PLR2004", "SLF001"] diff --git a/test/conftest.py b/test/conftest.py new file mode 100644 index 0000000..121ded2 --- /dev/null +++ b/test/conftest.py @@ -0,0 +1,27 @@ +# Copyright (c) 2023 Nanahuse +# This software is released under the MIT License +# https://opensource.org/license/mit/ + +import pytest +from _pytest.config import Config +from _pytest.config.argparsing import Parser +from _pytest.nodes import Item + + +def pytest_addoption(parser: Parser) -> None: + parser.addoption( + "--run-voicepeak-integration", + action="store_true", + default=False, + help="run integration tests that require a local VOICEPEAK installation", + ) + + +def pytest_collection_modifyitems(config: Config, items: list[Item]) -> None: + if config.getoption("--run-voicepeak-integration"): + return + + skip = pytest.mark.skip(reason="requires a local VOICEPEAK installation; pass --run-voicepeak-integration to run") + for item in items: + if item.get_closest_marker("voicepeak"): + item.add_marker(skip) diff --git a/test/manual_voicepeak_file_generation.py b/test/test_manual_voicepeak_file_generation.py similarity index 86% rename from test/manual_voicepeak_file_generation.py rename to test/test_manual_voicepeak_file_generation.py index 1dfd812..0cabb42 100644 --- a/test/manual_voicepeak_file_generation.py +++ b/test/test_manual_voicepeak_file_generation.py @@ -1,15 +1,26 @@ +# Copyright (c) 2023 Nanahuse +# This software is released under the MIT License +# https://opensource.org/license/mit/ + """VOICEPEAK integration tests that create output files. -These tests require a local VOICEPEAK installation. Pytest does not collect this -module by default; run it explicitly when file-generation coverage is needed: +These tests require a local VOICEPEAK installation and are skipped by default. +Run the full suite with the option below when file-generation coverage is needed: + + uv run --group dev --with-editable . pytest --run-voicepeak-integration - uv run --extra dev --with-editable . pytest test/manual_voicepeak_file_generation.py +Or run just this module: + + uv run --group dev --with-editable . pytest \\ + test/test_manual_voicepeak_file_generation.py --run-voicepeak-integration """ import os import pytest +pytestmark = pytest.mark.voicepeak + TEST_DIRECTORY = os.path.dirname(os.path.abspath(__file__)) OUTPUT_PATH = os.path.join(TEST_DIRECTORY, "output") From 72447f64959815c072112cad5c5f97b5b226bded Mon Sep 17 00:00:00 2001 From: Nanahuse <109294061+Nanahuse@users.noreply.github.com> Date: Sun, 9 Aug 2026 10:16:07 +0900 Subject: [PATCH 3/3] Use pytest runxfail for manual tests --- pyproject.toml | 3 --- test/conftest.py | 27 ------------------- test/test_manual_voicepeak_file_generation.py | 14 ++++++---- 3 files changed, 9 insertions(+), 35 deletions(-) delete mode 100644 test/conftest.py diff --git a/pyproject.toml b/pyproject.toml index 3e9511e..313356b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -42,9 +42,6 @@ lint.ignore = [ [tool.pytest.ini_options] pythonpath = ["."] -markers = [ - "voicepeak: manual integration tests that require a local VOICEPEAK installation (skipped by default; pass --run-voicepeak-integration)", -] [tool.ruff.per-file-ignores] "test/*" = ["INP001", "PLR2004", "SLF001"] diff --git a/test/conftest.py b/test/conftest.py deleted file mode 100644 index 121ded2..0000000 --- a/test/conftest.py +++ /dev/null @@ -1,27 +0,0 @@ -# Copyright (c) 2023 Nanahuse -# This software is released under the MIT License -# https://opensource.org/license/mit/ - -import pytest -from _pytest.config import Config -from _pytest.config.argparsing import Parser -from _pytest.nodes import Item - - -def pytest_addoption(parser: Parser) -> None: - parser.addoption( - "--run-voicepeak-integration", - action="store_true", - default=False, - help="run integration tests that require a local VOICEPEAK installation", - ) - - -def pytest_collection_modifyitems(config: Config, items: list[Item]) -> None: - if config.getoption("--run-voicepeak-integration"): - return - - skip = pytest.mark.skip(reason="requires a local VOICEPEAK installation; pass --run-voicepeak-integration to run") - for item in items: - if item.get_closest_marker("voicepeak"): - item.add_marker(skip) diff --git a/test/test_manual_voicepeak_file_generation.py b/test/test_manual_voicepeak_file_generation.py index 0cabb42..30e309f 100644 --- a/test/test_manual_voicepeak_file_generation.py +++ b/test/test_manual_voicepeak_file_generation.py @@ -4,22 +4,26 @@ """VOICEPEAK integration tests that create output files. -These tests require a local VOICEPEAK installation and are skipped by default. -Run the full suite with the option below when file-generation coverage is needed: +These tests require a local VOICEPEAK installation and are marked xfail with +``run=False``, so they are reported as NOTRUN without launching VOICEPEAK. Run +them with pytest's built-in ``--runxfail`` option when file-generation coverage +is needed: - uv run --group dev --with-editable . pytest --run-voicepeak-integration + uv run --group dev --with-editable . pytest --runxfail Or run just this module: uv run --group dev --with-editable . pytest \\ - test/test_manual_voicepeak_file_generation.py --run-voicepeak-integration + test/test_manual_voicepeak_file_generation.py --runxfail """ import os import pytest -pytestmark = pytest.mark.voicepeak +pytestmark = pytest.mark.xfail( + run=False, reason="requires a local VOICEPEAK installation; pass --runxfail to run" +) TEST_DIRECTORY = os.path.dirname(os.path.abspath(__file__)) OUTPUT_PATH = os.path.join(TEST_DIRECTORY, "output")