Skip to content

pytest 9.02 TypeError, 9.01 works #14334

@tquinn2

Description

@tquinn2
  • a detailed description of the bug or problem you are having
  • output of pip list from the virtual environment you are using
  • pytest and operating system versions
  • minimal example if possible

Description

When running pytest version 9.0.2 I get the following errors, related to python's AST. I think the key error message here is INTERNALERROR> TypeError: required field "col_offset" missing from stmt. Reverting to pytest version 9.0.1 fixes this issue.

INTERNALERROR> Traceback (most recent call last):
INTERNALERROR>   File "C:\temp\pytest_demo\testing-demo\.venv\Lib\site-packages\_pytest\main.py", line 314, in wrap_session
INTERNALERROR>     config._do_configure()
INTERNALERROR>   File "C:\temp\pytest_demo\testing-demo\.venv\Lib\site-packages\_pytest\config\__init__.py", line 1159, in _do_configure
INTERNALERROR>     self.hook.pytest_configure.call_historic(kwargs=dict(config=self))
INTERNALERROR>   File "C:\temp\pytest_demo\testing-demo\.venv\Lib\site-packages\pluggy\_hooks.py", line 534, in call_historic
INTERNALERROR>     res = self._hookexec(self.name, self._hookimpls.copy(), kwargs, False)
INTERNALERROR>           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "C:\temp\pytest_demo\testing-demo\.venv\Lib\site-packages\pluggy\_manager.py", line 120, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
INTERNALERROR>            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "C:\temp\pytest_demo\testing-demo\.venv\Lib\site-packages\pluggy\_callers.py", line 167, in _multicall
INTERNALERROR>     raise exception
INTERNALERROR>   File "C:\temp\pytest_demo\testing-demo\.venv\Lib\site-packages\pluggy\_callers.py", line 121, in _multicall
INTERNALERROR>     res = hook_impl.function(*args)
INTERNALERROR>           ^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "C:\temp\pytest_demo\testing-demo\.venv\Lib\site-packages\_pytest\terminal.py", line 304, in pytest_configure
INTERNALERROR>     config.pluginmanager.import_plugin("terminalprogress")
INTERNALERROR>   File "C:\temp\pytest_demo\testing-demo\.venv\Lib\site-packages\_pytest\config\__init__.py", line 879, in import_plugin
INTERNALERROR>     __import__(importspec)
INTERNALERROR>   File "<frozen importlib._bootstrap>", line 1354, in _find_and_load
INTERNALERROR>   File "<frozen importlib._bootstrap>", line 1325, in _find_and_load_unlocked
INTERNALERROR>   File "<frozen importlib._bootstrap>", line 929, in _load_unlocked
INTERNALERROR>   File "C:\temp\pytest_demo\testing-demo\.venv\Lib\site-packages\_pytest\assertion\rewrite.py", line 188, in exec_module
INTERNALERROR>     source_stat, co = _rewrite_test(fn, self.config)
INTERNALERROR>                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "C:\temp\pytest_demo\testing-demo\.venv\Lib\site-packages\_pytest\assertion\rewrite.py", line 359, in _rewrite_test
INTERNALERROR>     co = compile(tree, strfn, "exec", dont_inherit=True)
INTERNALERROR>          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> TypeError: required field "col_offset" missing from stmt

pip list

colorama     0.4.6
iniconfig    2.3.0
packaging    26.0
pluggy       1.6.0
pygments     2.19.2
pytest       9.0.2
testing-demo 0.1.0   C:\temp\pytest_demo\testing-demo

Versions

Python: 3.13.1
pytest: 9.0.2
OS: Windows 10 (22H2)

Minimal example

# tests/my_test.py

import pytest

def test_add_with_fixture():
    assert True

I also tried this:
https://pydevtools.com/handbook/tutorial/setting-up-testing-with-pytest-and-uv/

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: needs informationreporter needs to provide more information; can be closed after 2 or more weeks of inactivity

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions