diff --git a/pyproject.toml b/pyproject.toml index d925e8c..5f186e6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -50,6 +50,7 @@ optional-dependencies.test = [ "covdefaults>=2.3", "diff-cover>=8.0.1", "pytest>=7.4.3", + "pytest-console-scripts>=1.4.1", "pytest-cov>=4.1", "pytest-mock>=3.12", "virtualenv<21,>=20.25", diff --git a/tests/test_pipdeptree.py b/tests/test_pipdeptree.py index 5816010..7b565b0 100644 --- a/tests/test_pipdeptree.py +++ b/tests/test_pipdeptree.py @@ -1,13 +1,17 @@ from __future__ import annotations import sys -from pathlib import Path from subprocess import check_call # noqa: S404 +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from pytest_console_scripts import ScriptRunner def test_main() -> None: check_call([sys.executable, "-m", "pipdeptree", "--help"]) -def test_console() -> None: - check_call([Path(sys.executable).parent / "pipdeptree", "--help"]) +def test_console(script_runner: ScriptRunner) -> None: + result = script_runner.run("pipdeptree", "--help") + assert result.success