sopel-irc / sopel

:robot::speech_balloon: An easy-to-use and highly extensible IRC Bot framework. Formerly Willie.
https://sopel.chat
Other
949 stars 403 forks source link

dice: local test failure on Python 3.8 #2544

Closed SnoopJ closed 11 months ago

SnoopJ commented 11 months ago

Description

Starting with d9b6a74, test_example_roll_4 fails for me locally with Python 3.8:

15:45 [snoopjedi@denton ~/repos/sopel-src (d9b6a74f...)]
$ python3.8 -m pytest -k "test_example_roll_4"
======================================================================== test session starts =========================================================================
platform linux -- Python 3.8.10, pytest-7.4.3, pluggy-1.3.0
rootdir: /var/lib/gitea/data/gitea-repositories/snoopj/sopel.git
configfile: pyproject.toml
plugins: sopel-8.0.0.dev0, requests-mock-1.9.3, vcr-1.0.2
collected 1355 items / 1354 deselected / 1 selected                                                                                                                  

sopel/builtins/dice.py F                                                                                                                                       [100%]

============================================================================== FAILURES ==============================================================================
________________________________________________________________________ test_example_roll_4 _________________________________________________________________________
sopel/tests/pytest_plugin.py:150: in test
    assert expected == output
E   assert "I can't disp... that big. =(" == '1000d999^100...(...)^(...) ='
E     - 1000d999^1000d99: (...)^(...) =
E     + I can't display a number that big. =(
====================================================================== short test summary info =======================================================================
FAILED sopel/builtins/dice.py::test_example_roll_4 - assert "I can't disp... that big. =(" == '1000d999^100...(...)^(...) ='
================================================================= 1 failed, 1354 deselected in 4.24s =================================================================

The failure is consistent and does not occur on the parent commit:

15:46 [snoopjedi@denton ~/repos/sopel-src (0371d0b0...)]
$ python3.8 -m pytest -k "test_example_roll_4"
======================================================================== test session starts =========================================================================
platform linux -- Python 3.8.10, pytest-7.4.3, pluggy-1.3.0
rootdir: /var/lib/gitea/data/gitea-repositories/snoopj/sopel.git
configfile: pyproject.toml
plugins: sopel-8.0.0.dev0, requests-mock-1.9.3, vcr-1.0.2
collected 1341 items / 1340 deselected / 1 selected                                                                                                                  

sopel/builtins/dice.py .                                                                                                                                       [100%]

================================================================= 1 passed, 1340 deselected in 3.03s =================================================================

Assigning to @dgw since he wrote #2532

Reproduction steps

Checkout d9b6a74, run python3.8 -m pytest -k "test_example_roll_4"

Expected behavior

The test should behave the same locally as it does in CI.

Relevant logs

No response

Notes

No response

Sopel version

d9b6a74f

Installation method

pip install

Python version

3.8

Operating system

Ubuntu 20.04

IRCd

No response

Relevant plugins

dice

SnoopJ commented 11 months ago

~After clarifying with @dgw, this seems to happen with Ubuntu 20.04's Python 3.8.10 specifically (i.e. this does not reproduce in a freshly-installed 3.8.10 via pyenv). We may have just stumbled on a Debian-ism~

Scratch that, it does reproduce, we both missed a silly mistake in the attempted reproduction.

SnoopJ commented 11 months ago

Furthermore, the issue does not occur in 3.8.18 for either of us. Still unclear what's going on.

dgw commented 11 months ago

3.8.10 reproduces, and 3.8.18 (the latest available maintenance release of Python 3.8) does not. Python's "What's New" section says that the security feature this failing test checks was added in 3.8.14.

Maybe we can close this with a note in the OP to "update your Python" if a user runs into this while running tests for some reason? Sopel 8 claims support for Python 3.8+, sure, but we kind of have to assume users will stay up-to-date within each release series. Even 3.8.14 is almost 14 months old at this point.

SnoopJ commented 11 months ago

Nice find. It'd be nice if the test could be skipped on that version, but I can live with "simply don't do that" being the resolution here since 3.8 is not long for this world anyway, and the offending version is pretty old. It'll be annoying for any Debian/Ubuntu users running the affected versions who want to run the test, but not insurmountable. We are, after all, the main people who run the tests.

dgw commented 11 months ago

I suppose it's important to mention that Ubuntu 20.04 is probably the most popular distro release out there with Python 3.8 as the default, and it ships 3.8.10. There are about 18 months left of mainline support on that particular LTS, but "Ubuntu Pro" subscribers will get security updates until 2030.

But we can still most likely just say "don't do that". This only affects developers running the test suite; users merely running the bot might see different behavior, but the difference is non-critical (just changes which error you see when) and won't crash anything.