jaraco / irc

Full-featured Python IRC library for Python.
MIT License
390 stars 84 forks source link

Test regressions: irc/dict.py::irc.dict.IRCDict, irc/strings.py::irc.strings.IRCFoldedCase #202

Open mgorny opened 1 year ago

mgorny commented 1 year ago

The test suite seems to have started failing:

$ tox -e py310
.pkg-cpython310: install_requires> python -I -m pip install 'setuptools>=56' 'setuptools_scm[toml]>=3.4.1'
.pkg-cpython310: _optional_hooks> python /usr/lib/python3.11/site-packages/pyproject_api/_backend.py True setuptools.build_meta
.pkg-cpython310: get_requires_for_build_editable> python /usr/lib/python3.11/site-packages/pyproject_api/_backend.py True setuptools.build_meta
.pkg-cpython310: install_requires_for_build_editable> python -I -m pip install wheel
.pkg-cpython310: build_editable> python /usr/lib/python3.11/site-packages/pyproject_api/_backend.py True setuptools.build_meta
py310: install_package_deps> python -I -m pip install 'flake8<5' 'importlib-metadata; python_version < "3.8"' jaraco.collections 'jaraco.functools>=1.20' jaraco.logging jaraco.stream jaraco.text more-itertools pygments 'pytest-black>=0.3.7; platform_python_implementation != "PyPy"' 'pytest-checkdocs>=2.4' pytest-cov 'pytest-enabler>=1.3' 'pytest-flake8; python_version < "3.12"' 'pytest-mypy>=0.9.1; platform_python_implementation != "PyPy"' 'pytest>=6' pytz 'tempora>=1.6'
py310: install_package> python -I -m pip install --force-reinstall --no-deps .tox/.tmp/package/1/irc-20.1.1.dev26+gd9a426a-0.editable-py3-none-any.whl
py310: commands[0]> pytest
========================================================= test session starts =========================================================
platform linux -- Python 3.10.9, pytest-7.2.0, pluggy-1.0.0
cachedir: .tox/py310/.pytest_cache
rootdir: /tmp/irc, configfile: pytest.ini
plugins: checkdocs-2.9.0, black-0.3.12, cov-4.0.0, enabler-2.0.0, flake8-1.1.1, mypy-0.10.3
collected 127 items                                                                                                                   

conftest.py ....                                                                                                                [  3%]
. .                                                                                                                             [  3%]
docs/conf.py ...                                                                                                                [  6%]
irc/__init__.py ...                                                                                                             [  8%]
irc/bot.py ....                                                                                                                 [ 11%]
irc/client.py .......                                                                                                           [ 17%]
irc/client_aio.py ...                                                                                                           [ 19%]
irc/connection.py ...                                                                                                           [ 22%]
irc/ctcp.py ...                                                                                                                 [ 24%]
irc/dict.py ...F                                                                                                                [ 27%]
irc/events.py ...                                                                                                               [ 30%]
irc/features.py ......                                                                                                          [ 34%]
irc/message.py .....                                                                                                            [ 38%]
irc/modes.py ......                                                                                                             [ 43%]
irc/rfc.py ...                                                                                                                  [ 46%]
irc/schedule.py ...                                                                                                             [ 48%]
irc/server.py ...                                                                                                               [ 50%]
irc/strings.py ...F                                                                                                             [ 53%]
irc/tests/__init__.py ...                                                                                                       [ 56%]
irc/tests/test_bot.py ................                                                                                          [ 69%]
irc/tests/test_client.py ........                                                                                               [ 75%]
irc/tests/test_client_aio.py ....                                                                                               [ 78%]
scripts/dccreceive.py ...                                                                                                       [ 80%]
scripts/dccsend.py ...                                                                                                          [ 83%]
scripts/irccat-aio.py ...                                                                                                       [ 85%]
scripts/irccat.py ...                                                                                                           [ 88%]
scripts/irccat2-aio.py ...                                                                                                      [ 90%]
scripts/irccat2.py ...                                                                                                          [ 92%]
scripts/servermap.py ...                                                                                                        [ 95%]
scripts/ssl-cat.py ...                                                                                                          [ 97%]
scripts/testbot.py ...                                                                                                          [100%]

============================================================== FAILURES ===============================================================
_____________________________________________________ [doctest] irc.dict.IRCDict ______________________________________________________
016 
017     >>> '[This]' in ''.join(d.keys())
018     True
019 
020     But the keys can be referenced with a different case
021 
022     >>> d['a'] == 'foo'
023     True
024 
025     >>> d['{this}'] == 'that'
UNEXPECTED EXCEPTION: KeyError('{this}')
Traceback (most recent call last):
  File "/usr/lib/python3.10/doctest.py", line 1350, in __run
    exec(compile(example.source, filename, "single",
  File "<doctest irc.dict.IRCDict[3]>", line 1, in <module>
  File "/tmp/irc/.tox/py310/lib/python3.10/site-packages/jaraco/collections.py", line 341, in __getitem__
    return super(KeyTransformingDict, self).__getitem__(key)
KeyError: '{this}'
/tmp/irc/irc/dict.py:25: UnexpectedException
_________________________________________________ [doctest] irc.strings.IRCFoldedCase _________________________________________________
007 
008     A version of FoldedCase that honors the IRC specification for lowercased
009     strings (RFC 1459).
010 
011     >>> IRCFoldedCase('Foo^').lower()
012     'foo~'
013 
014     >>> IRCFoldedCase('[this]') == IRCFoldedCase('{THIS}')
Expected:
    True
Got:
    False

/tmp/irc/irc/strings.py:14: DocTestFailure
========================================================== warnings summary ===========================================================
irc/tests/test_bot.py::TestBot::test_reconnects_are_stable
  /tmp/irc/irc/tests/test_bot.py:141: ResourceWarning: unclosed <socket.socket fd=12, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('127.0.0.1', 56410)>
    bot.reactor.process_once()
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

irc/tests/test_bot.py::TestBot::test_reconnects_are_stable
  /tmp/irc/irc/tests/test_bot.py:141: ResourceWarning: unclosed <socket.socket fd=12, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('127.0.0.1', 56424)>
    bot.reactor.process_once()
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html

---------- coverage: platform linux, python 3.10.9-final-0 -----------
Name                           Stmts   Miss  Cover   Missing
------------------------------------------------------------
conftest.py                        8      3    62%   8-10
docs/conf.py                      16      0   100%
irc/__init__.py                    9      3    67%   5-6, 12
irc/bot.py                       229     86    62%   45, 195-196, 205-209, 212-218, 221-230, 248-258, 261-265, 268-274, 277-280, 290-291, 302, 319, 330-340, 343, 347-348, 373, 378, 382, 386, 390, 406, 410, 414, 432-433, 436-437, 451, 466-468, 471, 474, 477, 480, 483, 486, 489, 492, 495-498, 501
irc/client.py                    569    222    61%   171, 187-188, 194, 203, 213-215, 232, 239-244, 256-268, 282, 285-286, 290, 292, 302-343, 348, 350, 355-356, 378-379, 400, 404, 408, 426-446, 450-452, 456, 474, 482, 486, 490, 499, 503, 507, 511, 515, 519, 523, 527, 531, 540, 544, 548, 552, 556, 560, 568-569, 587-588, 603, 614, 618, 622, 626, 630, 639, 643, 647, 651, 655, 659, 663, 670, 678-679, 844-846, 850-852, 890-896, 908-911, 924, 928-930, 959-960, 972-983, 995-1006, 1015-1029, 1034-1085, 1093-1095, 1101-1105, 1162, 1174-1176, 1189-1190, 1197-1198, 1202, 1253, 1349
irc/client_aio.py                 83     21    75%   78, 81-82, 141, 168, 179-186, 195, 205-214, 278, 295
irc/connection.py                 23      1    96%   52
irc/ctcp.py                       25     16    36%   18-22, 41-49, 53-70
irc/dict.py                        9      0   100%
irc/events.py                      5      0   100%
irc/features.py                   51      9    82%   38-39, 49, 54, 57-58, 105-107
irc/message.py                    27      2    93%   43-44
irc/modes.py                      17      0   100%
irc/rfc.py                        20     11    45%   5-7, 15-16, 20-21, 25, 29-30, 34
irc/schedule.py                   18      2    89%   32, 35
irc/server.py                    281    207    26%   72-73, 76, 80, 89-92, 118-125, 131-145, 148-159, 162-187, 190-197, 203-250, 256-265, 271-272, 279-319, 325, 331, 337-361, 368-370, 376-395, 401-415, 421-427, 433-442, 445-457, 476-481, 483, 490, 518-537, 541-554, 558
irc/strings.py                     8      1    88%   38
irc/tests/__init__.py              0      0   100%
irc/tests/test_bot.py             92      0   100%
irc/tests/test_client.py          29      0   100%
irc/tests/test_client_aio.py      25      0   100%
scripts/dccreceive.py             57     40    30%   25-26, 29-42, 45-48, 51-53, 56, 60-68, 72-81, 85
scripts/dccsend.py                65     46    29%   22-27, 30-42, 45-48, 51-52, 55-60, 63, 66-67, 70-72, 76-85, 89-98, 102
scripts/irccat2-aio.py            52     37    29%   18-19, 22-25, 30, 35-36, 39-47, 51-58, 62-78, 82
scripts/irccat2.py                46     36    22%   16-17, 20-23, 26, 29, 32-37, 41-65, 69
scripts/irccat-aio.py             55     39    29%   21-23, 27, 33-34, 38-43, 47, 51-58, 64-92, 96
scripts/irccat.py                 48     33    31%   22-25, 29, 33-34, 38-41, 45, 49-55, 61-76, 80
scripts/servermap.py              75     61    19%   53-55, 59-60, 66, 72-92, 96, 100-112, 116-121, 125-130, 136-156, 160
scripts/ssl-cat.py                47     32    32%   22-25, 29, 33-34, 38-41, 45, 49-54, 60-77, 81
scripts/testbot.py                74     59    20%   35-36, 39, 42, 45, 48-53, 57-58, 61-70, 73-99, 103-123, 127
------------------------------------------------------------
TOTAL                           2063    967    53%

================================================================ mypy =================================================================
Success: no issues found in 30 source files
======================================================= short test summary info =======================================================
FAILED irc/dict.py::irc.dict.IRCDict
FAILED irc/strings.py::irc.strings.IRCFoldedCase
============================================= 2 failed, 124 passed, 2 warnings in 33.41s ==============================================
py310: exit 1 (34.46 seconds) /tmp/irc> pytest pid=4857
.pkg-cpython310: _exit> python /usr/lib/python3.11/site-packages/pyproject_api/_backend.py True setuptools.build_meta
  py310: FAIL code 1 (57.19=setup[22.73]+cmd[34.46] seconds)
  evaluation failed :( (57.43 seconds)

Original report: https://bugs.gentoo.org/888013