pynamodb / PynamoDB

A pythonic interface to Amazon's DynamoDB
http://pynamodb.readthedocs.io
MIT License
2.46k stars 427 forks source link

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

Open kloczek opened 5 months ago

kloczek commented 5 months ago

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 commented 5 months ago

Eek, any idea why?