Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

6.0.0: pytest fails in tests/test_attributes.py::TestMapAttribute::test_complex_map_accessors unit #1244

Open
kloczek opened this issue May 30, 2024 · 1 comment

Comments

@kloczek
Copy link

kloczek commented May 30, 2024

After switching to pytest 8.2.1 I've noticed that one unit started failing.

=================================== FAILURES ===================================
_________________ TestMapAttribute.test_complex_map_accessors __________________

self = <tests.test_attributes.TestMapAttribute object at 0x7f829394dc90>

    def test_complex_map_accessors(self):
        class NestedThing(MapAttribute):
            double_nested = MapAttribute()
            double_nested_renamed = MapAttribute(attr_name='something_else')

        class ThingModel(Model):
            key = NumberAttribute(hash_key=True)
            nested = NestedThing()

        t = ThingModel(nested=NestedThing(
            double_nested={'hello': 'world'},
            double_nested_renamed={'foo': 'bar'})
        )

        assert t.nested.double_nested.as_dict() == {'hello': 'world'}
        assert t.nested.double_nested_renamed.as_dict() == {'foo': 'bar'}
        assert t.nested.double_nested.hello == 'world'
        assert t.nested.double_nested_renamed.foo == 'bar'
        assert t.nested['double_nested'].as_dict() == {'hello': 'world'}
        assert t.nested['double_nested_renamed'].as_dict() == {'foo': 'bar'}
        assert t.nested['double_nested']['hello'] == 'world'
        assert t.nested['double_nested_renamed']['foo'] == 'bar'

>       with pytest.raises(AttributeError):
E       Failed: DID NOT RAISE <class 'AttributeError'>

tests/test_attributes.py:847: Failed
=========================== short test summary info ============================
FAILED tests/test_attributes.py::TestMapAttribute::test_complex_map_accessors
================ 1 failed, 377 passed, 20 deselected in 14.91s =================
/usr/lib/python3.10/site-packages/_pytest/pathlib.py:98: PytestWarning: (rm_rf) error removing /tmp/pytest-of-tkloczko/garbage-a2fe780f-cdd8-4b68-9785-67d2ba1c23b1
<class 'OSError'>: [Errno 39] Directory not empty: '/tmp/pytest-of-tkloczko/garbage-a2fe780f-cdd8-4b68-9785-67d2ba1c23b1'
  warnings.warn(
@ikonst
Copy link
Contributor

ikonst commented May 30, 2024

Eek, any idea why?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants