(Since Python 3.13.8 commit python/cpython@ebccd1de88d,) test_import_loop_detection_self() fails when trying to run it with pytest-xdist 3.8 - even with a single process (-n 1)
complaint = "unsupported operand type(s) for +: 'int' and 'Reader'"
Reproduced with today's commit ed868f7.
This is worth noting because this is currently the only test failing with pytest-xdist. EDIT: xdist was only the messenger, merely offsetting the stack. See #919 for reproduction without xdist
I checked out the commit 16e2250 where this test was introduced + various others and that test was always incompatible with xdist 3.8.0 (warning: don't forget export WEST_SKIP_SLOW_TESTS=0)
To reproduce:
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -45,6 +45,7 @@ test = [
"coverage~=7.10",
"pytest>=8.4,<10.0",
"pytest-cov~=7.0",
+ "pytest-xdist", # not needed after all, see PR #919 instead
]
types = [
"mypy~=1.18",
EDIT: newer and much better stack trace in later comment below #908 (comment)
Details
```
uv run poe test -k import_loop_detect -n 1 # test passes without "-n 1"
<very long stack, most likely due to the import recursion being tested>
src/west/manifest.py:2300: in _import_path_from_self
self._import_pathobj_from_self(pathobj_abs, pathobj)
src/west/manifest.py:2327: in _import_pathobj_from_self
Manifest(topdir=self.topdir, internal_import_ctx=child_ctx)
src/west/manifest.py:1620: in init
self._load_validated()
src/west/manifest.py:2089: in _load_validated
self._load_self(manifest_data)
src/west/manifest.py:2212: in _load_self
self._import_from_self(imp)
src/west/manifest.py:2281: in _import_from_self
self._import_path_from_self(imp)
src/west/manifest.py:2300: in _import_path_from_self
self._import_pathobj_from_self(pathobj_abs, pathobj)
src/west/manifest.py:2327: in _import_pathobj_from_self
Manifest(topdir=self.topdir, internal_import_ctx=child_ctx)
src/west/manifest.py:1620: in init
self._load_validated()
src/west/manifest.py:2089: in _load_validated
self._load_self(manifest_data)
src/west/manifest.py:2212: in _load_self
self._import_from_self(imp)
src/west/manifest.py:2281: in _import_from_self
self._import_path_from_self(imp)
src/west/manifest.py:2300: in _import_path_from_self
self._import_pathobj_from_self(pathobj_abs, pathobj)
src/west/manifest.py:2327: in _import_pathobj_from_self
Manifest(topdir=self.topdir, internal_import_ctx=child_ctx)
src/west/manifest.py:1616: in init
self._malformed(te.args[0], parent=te)
self = <west.manifest.Manifest object at 0x7f8d1df93850>, complaint = "unsupported operand type(s) for +: 'int' and 'Reader'"
parent = TypeError("unsupported operand type(s) for +: 'int' and 'Reader'")
def _malformed(self, complaint: str, parent: Exception | None = None) -> NoReturn:
context = f'file: {self._ctx.current_abspath} ' if self._ctx.current_abspath else 'data'
args = [f'Malformed manifest {context}', f'Schema file: {_SCHEMA_PATH}']
if complaint:
args.append('Hint: ' + complaint)
exc = MalformedManifest(*args)
if parent:
E west.manifest.MalformedManifest: ('Malformed manifest file: /tmp/pytest-/pytest-34/popen-gw0/test_import_loop_detection_sel0/topdir/mp/foo.yml ', 'Schema file: src/west/manifest-schema.yml',
"Hint: unsupported operand type(s) for +: 'int' and 'Reader'")
src/west/manifest.py:1975: MalformedManifest
(Since Python 3.13.8 commit python/cpython@ebccd1de88d,)
test_import_loop_detection_self()fails when trying to run it with pytest-xdist 3.8 - even with a single process (-n 1)complaint = "unsupported operand type(s) for +: 'int' and 'Reader'"Reproduced with today's commit ed868f7.
This is worth noting because this is currently the only test failing with pytest-xdist. EDIT:
xdistwas only the messenger, merely offsetting the stack. See #919 for reproduction withoutxdistI checked out the commit 16e2250 where this test was introduced + various others and that test was always incompatible with xdist 3.8.0 (warning: don't forget export
WEST_SKIP_SLOW_TESTS=0)To reproduce:
EDIT: newer and much better stack trace in later comment below #908 (comment)
Details
``` uv run poe test -k import_loop_detect -n 1 # test passes without "-n 1"<very long stack, most likely due to the import recursion being tested>
src/west/manifest.py:2300: in _import_path_from_self
self._import_pathobj_from_self(pathobj_abs, pathobj)
src/west/manifest.py:2327: in _import_pathobj_from_self
Manifest(topdir=self.topdir, internal_import_ctx=child_ctx)
src/west/manifest.py:1620: in init
self._load_validated()
src/west/manifest.py:2089: in _load_validated
self._load_self(manifest_data)
src/west/manifest.py:2212: in _load_self
self._import_from_self(imp)
src/west/manifest.py:2281: in _import_from_self
self._import_path_from_self(imp)
src/west/manifest.py:2300: in _import_path_from_self
self._import_pathobj_from_self(pathobj_abs, pathobj)
src/west/manifest.py:2327: in _import_pathobj_from_self
Manifest(topdir=self.topdir, internal_import_ctx=child_ctx)
src/west/manifest.py:1620: in init
self._load_validated()
src/west/manifest.py:2089: in _load_validated
self._load_self(manifest_data)
src/west/manifest.py:2212: in _load_self
self._import_from_self(imp)
src/west/manifest.py:2281: in _import_from_self
self._import_path_from_self(imp)
src/west/manifest.py:2300: in _import_path_from_self
self._import_pathobj_from_self(pathobj_abs, pathobj)
src/west/manifest.py:2327: in _import_pathobj_from_self
Manifest(topdir=self.topdir, internal_import_ctx=child_ctx)
src/west/manifest.py:1616: in init
self._malformed(te.args[0], parent=te)
self = <west.manifest.Manifest object at 0x7f8d1df93850>, complaint = "unsupported operand type(s) for +: 'int' and 'Reader'"
parent = TypeError("unsupported operand type(s) for +: 'int' and 'Reader'")
E west.manifest.MalformedManifest: ('Malformed manifest file: /tmp/pytest-/pytest-34/popen-gw0/test_import_loop_detection_sel0/topdir/mp/foo.yml ', 'Schema file: src/west/manifest-schema.yml',
"Hint: unsupported operand type(s) for +: 'int' and 'Reader'")
src/west/manifest.py:1975: MalformedManifest