tarpas / pytest-testmon

Selects tests affected by changed files. Executes the right tests first. Continuous test runner when used with pytest-watch.
https://testmon.org
MIT License
800 stars 54 forks source link

Python 3.8 test failures: ast.Constant #139

Closed hroncok closed 5 years ago

hroncok commented 5 years ago
$ tox -e py38-pytest41
GLOB sdist-make: .../pytest-testmon/setup.py
py38-pytest41 inst-nodeps: .../pytest-testmon/.tox/.tmp/package/1/pytest-testmon-0.9.15.zip
py38-pytest41 installed: atomicwrites==1.3.0,attrs==19.1.0,coverage==4.5.3,coverage-pth==0.0.2,more-itertools==7.0.0,pluggy==0.9.0,py==1.8.0,pytest==4.1.1,pytest-testmon==0.9.15,six==1.12.0
py38-pytest41 run-test-pre: PYTHONHASHSEED='2120733739'
py38-pytest41 runtests: commands[0] | py.test --tb=native test
============================= test session starts ==============================
platform linux -- Python 3.8.0a3, pytest-4.1.1, py-1.8.0, pluggy-0.9.0
cachedir: .tox/py38-pytest41/.pytest_cache
rootdir: .../pytest-testmon, inifile: pytest.ini
plugins: testmon-0.9.15
collected 100 items

test/test_core.py ...........................                            [ 27%]
test/test_process_code.py ......F........................                [ 58%]
test/test_subprocess.py .x.x                                             [ 62%]
test/test_testmon.py .............................x.......s              [100%]

=================================== FAILURES ===================================
______________________ TestReadSrc.test_module_with_1250 _______________________
Traceback (most recent call last):
  File ".../pytest-testmon/test/test_process_code.py", line 53, in test_module_with_1250
    assert "Str('\\xc5\\xa1')" in code_repr or "Str('š')" in Module(None, 'test/samples/print1250r.py').blocks[
AssertionError: assert ("Str('\\xc5\\xa1')" in "0:Expr(Call(Name('print', Load()), Constant('š', None), ))" or "Str('š')" in "0:Expr(Call(Name('print', Load()), Constant('š', None), ))")
 +  where "0:Expr(Call(Name('print', Load()), Constant('š', None), ))" = 2-2 h: 877007445, n:unknown, repr:0:Expr(Call(Name('print', Load()), Constant('š', None), )).code
========== 1 failed, 95 passed, 1 skipped, 3 xfailed in 7.49 seconds ===========
.../pytest-testmon/.tox/py38-pytest41/lib/python3.8/site-packages/testmon/process_code.py:9: SyntaxWarning: invalid escape sequence \s
  coding_re = re.compile(b'coding[=:]\s*([-\w.]+)')
ERROR: InvocationError for command '.../pytest-testmon/.tox/py38-pytest41/bin/py.test --tb=native test' (exited with code 1)
___________________________________ summary ____________________________________
ERROR:   py38-pytest41: commands failed

This is caused by https://github.com/python/cpython/pull/9445

Class ast.Constant is now used for all constants. Old classes ast.Num, ast.Str, ast.Bytes, ast.NameConstant and ast.Ellipsis are still available, but they will be removed in future Python releases.

Matlino commented 5 years ago

I am not able to reproduce the error. I ran the same command but it was successful. Could you verify the error? On which commit you get this error?

hroncok commented 5 years ago

bcd89a6f96988db3d5c553285a066d080ec02b77

hroncok commented 5 years ago

3b6855716865ef468f936c0d6814426772f35aef

$ tox -e py38-pytest41
GLOB sdist-make: .../pytest-testmon/setup.py
py38-pytest41 inst-nodeps: .../pytest-testmon/.tox/.tmp/package/1/pytest-testmon-0.9.16.zip
py38-pytest41 installed: atomicwrites==1.3.0,attrs==19.1.0,coverage==4.5.3,coverage-pth==0.0.2,more-itertools==7.0.0,pluggy==0.11.0,py==1.8.0,pytest==4.1.1,pytest-testmon==0.9.16,six==1.12.0
py38-pytest41 run-test-pre: PYTHONHASHSEED='3286914867'
py38-pytest41 runtests: commands[0] | py.test --tb=native test
============================= test session starts ==============================
platform linux -- Python 3.8.0a4, pytest-4.1.1, py-1.8.0, pluggy-0.11.0
cachedir: .tox/py38-pytest41/.pytest_cache
rootdir: .../pytest-testmon, inifile: pytest.ini
plugins: testmon-0.9.16
collected 101 items

test/test_core.py ...........................                            [ 26%]
test/test_process_code.py ......F........................                [ 57%]
test/test_subprocess.py .x.x                                             [ 61%]
test/test_testmon.py .............................x.......xs             [100%]

=================================== FAILURES ===================================
______________________ TestReadSrc.test_module_with_1250 _______________________
Traceback (most recent call last):
  File ".../pytest-testmon/test/test_process_code.py", line 53, in test_module_with_1250
    assert "Str('\\xc5\\xa1')" in code_repr or "Str('š')" in Module(None, 'test/samples/print1250r.py').blocks[
AssertionError: assert ("Str('\\xc5\\xa1')" in "0:Expr(Call(Name('print', Load()), Constant('š', None), ))" or "Str('š')" in "0:Expr(Call(Name('print', Load()), Constant('š', None), ))")
 +  where "0:Expr(Call(Name('print', Load()), Constant('š', None), ))" = 2-2 h: 877007445, n:unknown, repr:0:Expr(Call(Name('print', Load()), Constant('š', None), )).code
=============================== warnings summary ===============================
.tox/py38-pytest41/lib/python3.8/site-packages/pluggy/hooks.py:130
  .../pytest-testmon/.tox/py38-pytest41/lib/python3.8/site-packages/pluggy/hooks.py:130: DeprecationWarning: Use inspect.signature() instead of inspect.getfullargspec()
    return inspect.getfullargspec(func)
  ...

-- Docs: https://docs.pytest.org/en/latest/warnings.html
==== 1 failed, 95 passed, 1 skipped, 4 xfailed, 71 warnings in 7.44 seconds ====
.../pytest-testmon/.tox/py38-pytest41/lib/python3.8/site-packages/testmon/process_code.py:9: SyntaxWarning: invalid escape sequence \s
  coding_re = re.compile(b'coding[=:]\s*([-\w.]+)')
ERROR: InvocationError for command '.../pytest-testmon/.tox/py38-pytest41/bin/py.test --tb=native test' (exited with code 1)
___________________________________ summary ____________________________________
ERROR:   py38-pytest41: commands failed