tox plugin that makes tox use `pyenv which` to find python executables
Overall
score
98%
Build a Python utility that validates whether a command-line tool is installed with a specific version. The utility executes the tool's version command as a subprocess and verifies the output matches the expected version.
The utility should:
<tool_name> --version to retrieve version informationThe utility must handle three distinct error scenarios:
All custom exceptions should inherit from a base VersionCheckError exception.
@generates
class VersionCheckError(Exception):
"""Base exception for version checking errors."""
pass
class ToolNotFoundError(VersionCheckError):
"""Raised when the tool is not found in the system PATH."""
pass
class CommandFailedError(VersionCheckError):
"""Raised when the command execution fails with non-zero exit code."""
pass
class VersionMismatchError(VersionCheckError):
"""Raised when the actual version doesn't match the expected version."""
pass
def check_version(tool_name: str, expected_version: str) -> bool:
"""
Check if a tool's version matches the expected version.
Args:
tool_name: Name of the command-line tool to check
expected_version: Expected version string (e.g., "1.2.3")
Returns:
True if the version matches
Raises:
ToolNotFoundError: If the tool is not found in PATH
CommandFailedError: If the command exits with non-zero status
VersionMismatchError: If the version doesn't match
"""
passProvides subprocess execution and management capabilities for running external commands.
Install with Tessl CLI
npx tessl i tessl/pypi-tox-pyenvdocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10