Skip to content

Commit

Permalink
Fix test for Python 3.13.1 argparse chagne (#43)
Browse files Browse the repository at this point in the history
  • Loading branch information
adamchainz authored Dec 5, 2024
1 parent 65c556d commit e0fe2ba
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions tests/test_harlequin.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from __future__ import annotations

import os
import sys
from functools import partial
from inspect import getsource
from textwrap import dedent
Expand Down Expand Up @@ -30,10 +31,16 @@ def test_non_existent_database(self):
with pytest.raises(CommandError) as excinfo:
call_command("--database", "nonexistent")

assert excinfo.value.args[0] == (
"Error: argument --database: invalid choice: 'nonexistent' "
+ "(choose from 'default')"
)
if sys.version_info >= (3, 13, 1):
assert excinfo.value.args[0] == (
"Error: argument --database: invalid choice: 'nonexistent' "
+ "(choose from default)"
)
else:
assert excinfo.value.args[0] == (
"Error: argument --database: invalid choice: 'nonexistent' "
+ "(choose from 'default')"
)

def test_unsupported_vendor(self):
with mock.patch.object(connection, "vendor", new="novel"):
Expand Down

0 comments on commit e0fe2ba

Please sign in to comment.