pytest-dev / pytest-dev/pytest
Class Paths Have Strange Behavior on 8.3.4
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 14.5k
- Forks
- 3.4k
- Avg merge
- 2d 9h
- Merged PRs (30d)
- 35
Description
Hello! We are having an issue in our repo where 8.3.4 pytest (but not 8.3.3) caused our classes to have strange behavior at runtime with errors like:
if (dest_type, src_type, modifiers) not in self.write:
> raise IORegistryError._from_write_parts(dest_type, src_type, modifiers)
E anndata._io.specs.registry.IORegistryError: No method registered for writing <class 'opt.hostedtoolcache.Python.3_12_7.x64.lib.python3_12.site-packages.anndata._core.views.AwkwardArrayView'> into <class 'h5py._hl.group.Group'>
E Error raised while writing key 'awk_2d_ragged' of <class 'h5py._hl.group.Group'> to /obsm
when in reality, the AwkwardArrayView is in the self.write dictionary, but as
<class 'anndata._core.views.AwkwardArrayView'>:
(This screenshot is from my attempt to fix the issue where I printed out the contents of self.write)
Also weirdly I cannot reproduce this locally. I have tried creating a local reproducer with an src/package/__init__.py file for a dummy package like:
d = {}
class Foo():
pass
d[Foo] = True
def check(typ: type) -> bool:
return d[typ]
__all__ = ["Foo", "check"]
with a single pytest
from package import Foo, check
def test_check():
f = Foo()
assert check(type(f))
But this seems to work when I run pytest instead of throwing a KeyError. I will continue to try to dig but I wanted to report.
See also my various attempted to fix the issue
Python Env:
Compute Env:
- a detailed description of the bug or problem you are having
- output of
pip listfrom the virtual environment you are using - pytest and operating system versions
- minimal example if possible (attempted)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the reported anndata failure with pytest 8.3.4 and compare it with 8.3.3, using the environment details and the linked anndata issue. Check the provided minimal package example as well as the failing class lookup, then add a regression test showing the expected class identity behavior. Done means the regression passes on the affected version without breaking the existing test suite.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- testing-qa
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100