Fix broken tests. Drop python 3.8. (#580)

* Fix broken tests.  Drop python 3.8.
* Test on Python 3.13 too

---------

Co-authored-by: Simon Willison <swillison@gmail.com>
This commit is contained in:
Andrew Wason 2024-10-27 14:26:47 -04:00 committed by GitHub
parent 7e6031e382
commit a466ddf3cd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 12 additions and 7 deletions

View file

@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
@ -38,7 +38,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
python-version: '3.13'
cache: pip
cache-dependency-path: setup.py
- name: Install dependencies

View file

@ -11,7 +11,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
pydantic: ["==1.10.2", ">=2.0.0"]
steps:
- uses: actions/checkout@v4

View file

@ -63,5 +63,5 @@ setup(
"types-setuptools",
]
},
python_requires=">=3.8",
python_requires=">=3.9",
)

View file

@ -52,6 +52,9 @@ def test_keys_list(monkeypatch, tmpdir, args):
assert result2.output.strip() == "openai"
@pytest.mark.httpx_mock(
assert_all_requests_were_expected=False, can_send_already_matched_responses=True
)
def test_uses_correct_key(mocked_openai_chat, monkeypatch, tmpdir):
user_dir = tmpdir / "user-dir"
pathlib.Path(user_dir).mkdir()

View file

@ -133,19 +133,21 @@ def test_templates_prompt_save(templates_path, args, expected_prompt, expected_e
"Summarize this: Input text",
None,
),
(
pytest.param(
"boo",
["-s", "s"],
None,
None,
"Error: Cannot use -t/--template and --system together",
marks=pytest.mark.httpx_mock(assert_all_responses_were_requested=False),
),
(
pytest.param(
"prompt: 'Say $hello'",
[],
None,
None,
"Error: Missing variables: hello",
marks=pytest.mark.httpx_mock(assert_all_responses_were_requested=False),
),
(
"prompt: 'Say $hello'",
@ -183,4 +185,4 @@ def test_template_basic(
else:
assert result.exit_code == 1
assert result.output.strip() == expected_error
mocked_openai_chat.reset(assert_all_responses_were_requested=False)
mocked_openai_chat.reset()