Test failures with Python 3.10.0a7
See original GitHub issueHello, we see some test failures due to different reprs in Python 3.10.0a7.
This is on branch main, @ 9653a0e9f47ad2ae5135a974db52ddeb5bfcf5d9.
Fedora Linux 33, 34 or 35.
$ tox -e py310
... installs deps, kill ...
$ .tox/py310/bin/pip install -U https://github.com/benjaminp/six/archive/refs/heads/master.zip
$ tox -e py310 -- testing/test_pytester.py testing/python/metafunc.py
py310 inst-nodeps: /home/churchyard/Dokumenty/RedHat/pytest/.tox/.tmp/package/3/pytest-6.3.0.dev355+g9653a0e9f.tar.gz
py310 installed: argcomplete==1.12.2,attrs==20.3.0,certifi==2020.12.5,chardet==4.0.0,elementpath==2.2.1,hypothesis==6.9.1,idna==2.10,iniconfig==1.1.1,mock==4.0.3,nose==1.3.7,packaging==20.9,pluggy==0.13.1,py==1.10.0,Pygments==2.8.1,pyparsing==2.4.7,pytest @ file:///home/churchyard/Dokumenty/RedHat/pytest/.tox/.tmp/package/3/pytest-6.3.0.dev355%2Bg9653a0e9f.tar.gz,requests==2.25.1,six @ https://github.com/benjaminp/six/archive/refs/heads/master.zip,sortedcontainers==2.3.0,toml==0.10.2,urllib3==1.26.4,xmlschema==1.6.1
py310 run-test-pre: PYTHONHASHSEED='3484571371'
py310 run-test: commands[0] | pytest testing/test_pytester.py testing/python/metafunc.py
============================= test session starts ==============================
platform linux -- Python 3.10.0a7, pytest-6.3.0.dev355+g9653a0e9f, py-1.10.0, pluggy-0.13.1
cachedir: .tox/py310/.pytest_cache
rootdir: /home/churchyard/Dokumenty/RedHat/pytest, configfile: pyproject.toml
plugins: hypothesis-6.9.1
collected 155 items
testing/test_pytester.py ...................F. [ 13%]
testing/python/metafunc.py .......................F................. [ 40%]
testing/test_pytester.py x........................... [ 58%]
testing/python/metafunc.py ............................................. [ 87%]
............... [ 96%]
testing/test_pytester.py ....s [100%]
=================================== FAILURES ===================================
_____________________________ test_run_result_repr _____________________________
def test_run_result_repr() -> None:
outlines = ["some", "normal", "output"]
errlines = ["some", "nasty", "errors", "happened"]
# known exit code
r = pytester_mod.RunResult(1, outlines, errlines, duration=0.5)
> assert (
repr(r) == "<RunResult ret=ExitCode.TESTS_FAILED len(stdout.lines)=3"
" len(stderr.lines)=4 duration=0.50s>"
)
E AssertionError: assert '<RunResult r...ration=0.50s>' == '<RunResult r...ration=0.50s>'
E - <RunResult ret=ExitCode.TESTS_FAILED len(stdout.lines)=3 len(stderr.lines)=4 duration=0.50s>
E ? ---------
E + <RunResult ret=TESTS_FAILED len(stdout.lines)=3 len(stderr.lines)=4 duration=0.50s>
testing/test_pytester.py:747: AssertionError
________________________ TestMetafunc.test_idmaker_enum ________________________
self = <metafunc.TestMetafunc object at 0x7f666fa0a710>
def test_idmaker_enum(self) -> None:
enum = pytest.importorskip("enum")
e = enum.Enum("Foo", "one, two")
result = idmaker(("a", "b"), [pytest.param(e.one, e.two)])
> assert result == ["Foo.one-Foo.two"]
E AssertionError: assert ['one-two'] == ['Foo.one-Foo.two']
E At index 0 diff: 'one-two' != 'Foo.one-Foo.two'
E Use -v to get the full diff
testing/python/metafunc.py:451: AssertionError
=========================== short test summary info ============================
FAILED testing/test_pytester.py::test_run_result_repr - AssertionError: asser...
FAILED testing/python/metafunc.py::TestMetafunc::test_idmaker_enum - Assertio...
============= 2 failed, 151 passed, 1 skipped, 1 xfailed in 5.27s ==============
ERROR: InvocationError for command /home/churchyard/Dokumenty/RedHat/pytest/.tox/py310/bin/pytest testing/test_pytester.py testing/python/metafunc.py (exited with code 1)
___________________________________ summary ____________________________________
ERROR: py310: commands failed
The first problem is here:
The second is here:
This mgiht be related:
https://docs.python.org/3.10/whatsnew/3.10.html#enum says:
Enum repr() now returns enum_name.member_name and str() now returns member_name. Stdlib enums available as module constants have a repr() of module_name.member_name. (Contributed by Ethan Furman in bpo-40066.)
Package Version
---------------- -----------------------
argcomplete 1.12.2
attrs 20.3.0
certifi 2020.12.5
chardet 4.0.0
elementpath 2.2.1
hypothesis 6.9.1
idna 2.10
iniconfig 1.1.1
mock 4.0.3
nose 1.3.7
packaging 20.9
pip 21.0.1
pluggy 0.13.1
py 1.10.0
Pygments 2.8.1
pyparsing 2.4.7
pytest 6.3.0.dev355+g9653a0e9f
requests 2.25.1
setuptools 53.0.0
six 1.15.0
sortedcontainers 2.3.0
toml 0.10.2
urllib3 1.26.4
wheel 0.36.2
xmlschema 1.6.1
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (5 by maintainers)
Top Results From Across the Web
1948522 – pytest's own tests fail with Python 3.10
pytest fails to build with Python 3.10.0a7. ... RunResult(1, outlines, errlines, duration=0.5) > assert ( repr(r) == "<RunResult ret=ExitCode.TESTS_FAILED len( ...
Read more >What's New In Python 3.10 — Python 3.11.1 documentation
This article explains the new features in Python 3.10, compared to 3.9. Python 3.10 was released on October 4, 2021. For full details,...
Read more >Mailman 3 change of behaviour for '.' in sys.path between 3.10.0a7 ...
I have a failing test case in 3.10.0b1 for code that uses changes to sys.path and attempts to load unpackaged modules by changing...
Read more >Mailman 3 [RELEASE] The last Python 3.10 alpha (3.10.0a7) is ...
*Python 3.10.0a7*Release Date: April 5, 2021 ... Alpha releases are intended to make it easier to test the current state of new features...
Read more >Message 390953 - Python tracker - Issue Tracker
I've discovered this issue when I was debugging a test failure in IPython. ... I'm testing this on Fedora Linux with Python 3.10.0a7...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
If all we need is a custom repr on the enum let’s go for it
Fixed by #8540.