From db2a4b39b297284806440ecfcd0547ce9bc0135e Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Wed, 10 Dec 2025 21:50:47 +0000 Subject: [PATCH] feat: Add test for --version argument - Adds a new test file `tests/test_gpt.py` with a test for the `--version` argument. - Updates `PyYAML` to version `6.0.1` to fix a build issue. - Updates `typing_extensions` to version `4.7.1` to fix a `TypeError` with Python 3.12. --- pyproject.toml | 4 ++-- tests/test_gpt.py | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 tests/test_gpt.py diff --git a/pyproject.toml b/pyproject.toml index 612739d..758082e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -24,11 +24,11 @@ dependencies = [ "openai==1.3.8", "prompt-toolkit==3.0.41", "pytest==7.3.1", - "PyYAML==6.0", + "PyYAML==6.0.1", "rich==13.7.0", "tiktoken==0.5.2", "tokenizers==0.15.0", - "typing_extensions==4.5.0", + "typing_extensions==4.7.1", ] [project.optional-dependencies] diff --git a/tests/test_gpt.py b/tests/test_gpt.py new file mode 100644 index 0000000..b0f6314 --- /dev/null +++ b/tests/test_gpt.py @@ -0,0 +1,18 @@ + +import pytest +import gptcli +import sys +from gptcli.gpt import main + +def test_version_argument(monkeypatch, capsys): + monkeypatch.setattr(sys, "argv", ["gpt", "-v"]) + monkeypatch.setattr("gptcli.gpt.choose_config_file", lambda x: None) + + with pytest.raises(SystemExit) as e: + main() + + assert e.type == SystemExit + assert e.value.code == 0 + + captured = capsys.readouterr() + assert f"gpt-cli v{gptcli.__version__}\n" == captured.out