From 8fbe0ffcbfdaf5b74a7913f6c9d028481fd28484 Mon Sep 17 00:00:00 2001 From: "Thomas J. Fan" Date: Sun, 21 Dec 2025 20:25:02 -0500 Subject: [PATCH 1/2] Fix Python 3.14 support --- .github/workflows/test.yml | 4 ++-- test/test_wordcloud_cli.py | 6 +++--- wordcloud/wordcloud_cli.py | 5 +++-- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ffa3047db..e8f5c4579 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -16,8 +16,8 @@ jobs: os: ubuntu-24.04-arm - pyver: "3.12" os: ubuntu-24.04-arm - # - pyver: "3.14" - # os: ubuntu-24.04 + - pyver: "3.14" + os: ubuntu-24.04 runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v6 diff --git a/test/test_wordcloud_cli.py b/test/test_wordcloud_cli.py index 9a583b8fa..8ad097a48 100644 --- a/test/test_wordcloud_cli.py +++ b/test/test_wordcloud_cli.py @@ -184,9 +184,9 @@ def test_cli_regexp_invalid(tmp_text_file, capsys): @pytest.mark.no_cover @pytest.mark.parametrize("command,expected_output, expected_exit_code", [ - ("wordcloud_cli --help", "usage: wordcloud_cli", 0), - ("%s -m wordcloud --help" % sys.executable, "usage: __main__", 0), - ("%s %s/../wordcloud/wordcloud_cli.py --help" % (sys.executable, os.path.dirname(__file__)), "To execute the CLI", 1), + # ("wordcloud_cli --help", "usage: wordcloud_cli", 0), + ("%s -m wordcloud --help" % sys.executable, "A simple command line", 0), + # ("%s %s/../wordcloud/wordcloud_cli.py --help" % (sys.executable, os.path.dirname(__file__)), "To execute the CLI", 1), ]) def test_cli_as_executable(command, expected_output, expected_exit_code, tmpdir, capfd): diff --git a/wordcloud/wordcloud_cli.py b/wordcloud/wordcloud_cli.py index 4ddd3db4f..4b8e2e37b 100644 --- a/wordcloud/wordcloud_cli.py +++ b/wordcloud/wordcloud_cli.py @@ -3,6 +3,7 @@ """ from __future__ import absolute_import +import pathlib import sys import textwrap @@ -116,10 +117,10 @@ def make_parser(): '--fontfile', metavar='path', dest='font_path', help='path to font file you wish to use (default: DroidSansMono)') parser.add_argument( - '--mask', metavar='file', type=argparse.FileType('rb'), + '--mask', metavar='file', type=pathlib.Path, help='mask to use for the image form') parser.add_argument( - '--colormask', metavar='file', type=argparse.FileType('rb'), + '--colormask', metavar='file', type=pathlib.Path, help='color mask to use for image coloring') parser.add_argument( '--contour_width', metavar='width', default=0, type=float, From b9cbd30791dabb97832537893b9b4baa1e3376c0 Mon Sep 17 00:00:00 2001 From: "Thomas J. Fan" Date: Sun, 21 Dec 2025 20:29:41 -0500 Subject: [PATCH 2/2] Fix test --- test/test_wordcloud_cli.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/test_wordcloud_cli.py b/test/test_wordcloud_cli.py index 8ad097a48..00684eb06 100644 --- a/test/test_wordcloud_cli.py +++ b/test/test_wordcloud_cli.py @@ -184,9 +184,9 @@ def test_cli_regexp_invalid(tmp_text_file, capsys): @pytest.mark.no_cover @pytest.mark.parametrize("command,expected_output, expected_exit_code", [ - # ("wordcloud_cli --help", "usage: wordcloud_cli", 0), + ("wordcloud_cli --help", "usage: wordcloud_cli", 0), ("%s -m wordcloud --help" % sys.executable, "A simple command line", 0), - # ("%s %s/../wordcloud/wordcloud_cli.py --help" % (sys.executable, os.path.dirname(__file__)), "To execute the CLI", 1), + ("%s %s/../wordcloud/wordcloud_cli.py --help" % (sys.executable, os.path.dirname(__file__)), "To execute the CLI", 1), ]) def test_cli_as_executable(command, expected_output, expected_exit_code, tmpdir, capfd):