Skip to content

Commit

Permalink
[CI] run fasttest with pypy
Browse files Browse the repository at this point in the history
use pypy3 as py39 base python because the current pypy3
bases on Python 3.9. This ensures that fasttest-py39 runs
with pypy.

Fix gui_tests because pypy3 has a tkinter module but this just
raises ImportError if _tkinter is not installed; require_modules
does not work here for tkinter.

Change-Id: I2640dd17f62d5d40b54d8e5cf1279661d094e302
  • Loading branch information
xqt committed Aug 8, 2024
1 parent 37dbddd commit 20e5927
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
10 changes: 8 additions & 2 deletions tests/gui_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def test_tkinter(self):
self.assertIn('Main Page', text)


@require_modules('tkinter', 'PIL')
@require_modules('PIL')
def setUpModule():
"""Skip tests if tkinter or PIL is not installed.
Expand All @@ -67,7 +67,13 @@ def setUpModule():
'(set PYWIKIBOT_TEST_GUI=1 to enable)')

global EditBoxWindow, Tkdialog, tkinter
import tkinter

# pypy3 has a tkinter module which just raises importError if _tkinter
# is not installed; thus require_modules does not work for it.
try:
import tkinter
except ImportError as e:
raise unittest.SkipTest(e)

from pywikibot.userinterfaces.gui import EditBoxWindow, Tkdialog

Expand Down
7 changes: 4 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,20 @@ skipsdist = True
skip_missing_interpreters = True
envlist =
commit-message
flake8-py{37,312,py}
hacking-py{37,312,py}
flake8-py3{7,9,12}
hacking-py3{7,9,12}

[params]
# Note: tox 4 does not support multiple lines when doing parameters
# substitution.
generate_user_files = -W error::UserWarning -m pwb generate_user_files -family:wikipedia -lang:test -v

[testenv]
# pypy3 bases on Python 3.9
basepython =
py37: python3.7
py38: python3.8
py39: python3.9
py39: pypy3
py310: python3.10
py311: python3.11
py312: python3.12
Expand Down

0 comments on commit 20e5927

Please sign in to comment.