question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Assertion rewriting fails under Python 3.10.0a7+

See original GitHub issue
Traceback (most recent call last):
  ...
  File "_pytest/assertion/rewrite.py", line 161, in exec_module
    source_stat, co = _rewrite_test(fn, self.config)
  File "_pytest/assertion/rewrite.py", line 356, in _rewrite_test
    co = compile(tree, fn_, "exec", dont_inherit=True)
TypeError: required field "lineno" missing from alias
full traceback
Traceback (most recent call last):
  File "/home/runner/.cache/hypothesis-build-runtimes/python-versions/3.10-dev/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/home/runner/.cache/hypothesis-build-runtimes/python-versions/3.10-dev/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/home/runner/work/hypothesis/hypothesis/hypothesis-python/.tox/py310-full/lib/python3.10/site-packages/pytest/__main__.py", line 5, in <module>
    raise SystemExit(pytest.console_main())
  File "/home/runner/work/hypothesis/hypothesis/hypothesis-python/.tox/py310-full/lib/python3.10/site-packages/_pytest/config/__init__.py", line 185, in console_main
    code = main()
  File "/home/runner/work/hypothesis/hypothesis/hypothesis-python/.tox/py310-full/lib/python3.10/site-packages/_pytest/config/__init__.py", line 143, in main
    config = _prepareconfig(args, plugins)
  File "/home/runner/work/hypothesis/hypothesis/hypothesis-python/.tox/py310-full/lib/python3.10/site-packages/_pytest/config/__init__.py", line 318, in _prepareconfig
    config = pluginmanager.hook.pytest_cmdline_parse(
  File "/home/runner/work/hypothesis/hypothesis/hypothesis-python/.tox/py310-full/lib/python3.10/site-packages/pluggy/hooks.py", line 286, in __call__
    return self._hookexec(self, self.get_hookimpls(), kwargs)
  File "/home/runner/work/hypothesis/hypothesis/hypothesis-python/.tox/py310-full/lib/python3.10/site-packages/pluggy/manager.py", line 93, in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
  File "/home/runner/work/hypothesis/hypothesis/hypothesis-python/.tox/py310-full/lib/python3.10/site-packages/pluggy/manager.py", line 84, in <lambda>
    self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
  File "/home/runner/work/hypothesis/hypothesis/hypothesis-python/.tox/py310-full/lib/python3.10/site-packages/pluggy/callers.py", line 203, in _multicall
    gen.send(outcome)
  File "/home/runner/work/hypothesis/hypothesis/hypothesis-python/.tox/py310-full/lib/python3.10/site-packages/_pytest/helpconfig.py", line 100, in pytest_cmdline_parse
    config: Config = outcome.get_result()
  File "/home/runner/work/hypothesis/hypothesis/hypothesis-python/.tox/py310-full/lib/python3.10/site-packages/pluggy/callers.py", line 80, in get_result
    raise ex[1].with_traceback(ex[2])
  File "/home/runner/work/hypothesis/hypothesis/hypothesis-python/.tox/py310-full/lib/python3.10/site-packages/pluggy/callers.py", line 187, in _multicall
    res = hook_impl.function(*args)
  File "/home/runner/work/hypothesis/hypothesis/hypothesis-python/.tox/py310-full/lib/python3.10/site-packages/_pytest/config/__init__.py", line 1003, in pytest_cmdline_parse
    self.parse(args)
  File "/home/runner/work/hypothesis/hypothesis/hypothesis-python/.tox/py310-full/lib/python3.10/site-packages/_pytest/config/__init__.py", line 1283, in parse
    self._preparse(args, addopts=addopts)
  File "/home/runner/work/hypothesis/hypothesis/hypothesis-python/.tox/py310-full/lib/python3.10/site-packages/_pytest/config/__init__.py", line 1168, in _preparse
    self.pluginmanager.consider_preparse(args, exclude_only=False)
  File "/home/runner/work/hypothesis/hypothesis/hypothesis-python/.tox/py310-full/lib/python3.10/site-packages/_pytest/config/__init__.py", line 635, in consider_preparse
    self.consider_pluginarg(parg)
  File "/home/runner/work/hypothesis/hypothesis/hypothesis-python/.tox/py310-full/lib/python3.10/site-packages/_pytest/config/__init__.py", line 660, in consider_pluginarg
    self.import_plugin(arg, consider_entry_points=True)
  File "/home/runner/work/hypothesis/hypothesis/hypothesis-python/.tox/py310-full/lib/python3.10/site-packages/_pytest/config/__init__.py", line 713, in import_plugin
    self.register(mod, modname)
  File "/home/runner/work/hypothesis/hypothesis/hypothesis-python/.tox/py310-full/lib/python3.10/site-packages/_pytest/config/__init__.py", line 443, in register
    self.consider_module(plugin)
  File "/home/runner/work/hypothesis/hypothesis/hypothesis-python/.tox/py310-full/lib/python3.10/site-packages/_pytest/config/__init__.py", line 669, in consider_module
    self._import_plugin_specs(getattr(mod, "pytest_plugins", []))
  File "/home/runner/work/hypothesis/hypothesis/hypothesis-python/.tox/py310-full/lib/python3.10/site-packages/_pytest/config/__init__.py", line 676, in _import_plugin_specs
    self.import_plugin(import_spec)
  File "/home/runner/work/hypothesis/hypothesis/hypothesis-python/.tox/py310-full/lib/python3.10/site-packages/_pytest/config/__init__.py", line 703, in import_plugin
    __import__(importspec)
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "/home/runner/work/hypothesis/hypothesis/hypothesis-python/.tox/py310-full/lib/python3.10/site-packages/_pytest/assertion/rewrite.py", line 161, in exec_module
    source_stat, co = _rewrite_test(fn, self.config)
  File "/home/runner/work/hypothesis/hypothesis/hypothesis-python/.tox/py310-full/lib/python3.10/site-packages/_pytest/assertion/rewrite.py", line 356, in _rewrite_test
    co = compile(tree, fn_, "exec", dont_inherit=True)
TypeError: required field "lineno" missing from alias

I discovered this in the Hypothesis CI, with Pytest 6.2.3 on Ubuntu and python3.10-dev (alpha07) from pyenv. Unfortunately I don’t have a smaller reproducing example than that, since my only copy of alpha07 is on that CI server.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:2
  • Comments:15 (12 by maintainers)

github_iconTop GitHub Comments

7reactions
asottilecommented, May 4, 2021

upgrade to 6.2.4 to get the fix!

5reactions
hugovkcommented, Apr 30, 2021

Good news, the GitHub Actions weirdness has been resolved and latest pytest is working with 3.10-dev (example build from today). 🎈

What happened:

Something caused a premature Python-3.10.0b1.tgz to be released on the Python FTP servers (now removed): https://www.python.org/ftp/python/3.10.0/Python-3.10.0b1.tgz.

GitHub Actions’ automation integrated this into 3.10-dev. This has also been removed and 3.10-dev now points to the latest 3.10 alpha, in advance of next week’s real 3.10 beta release.

More details:

Read more comments on GitHub >

github_iconTop 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 >
Vulnerability report for Docker python:3.10.0a7-slim-buster | Snyk
Docker image python has 127 known vulnerabilities found in 203 vulnerable ... input sequences in the ISO-2022-JP-3 encoding, fails an assertion in the...
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 ... but in Python 3.10 a more...
Read more >
Changelog — Python 3.11.1 documentation
bpo-38031: Fix a possible assertion failure in io.FileIO when the opener returns ... now that getpath.c was rewritten in pure Python and the...
Read more >
Mailman 3 June 2021 - Python-Dev - python.org
PEP 563 and Python 3.10. ... Enum -- last call for comments on 3.10 changes ... PEP 657 Accepted - Include Fine Grained...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found