nestorsalceda / mamba

The definitive testing tool for Python. Born under the banner of Behavior Driven Development (BDD).
http://nestorsalceda.github.io/mamba
MIT License
518 stars 65 forks source link

Mamba doesn't work with mock.patch.object as a ContextManager #167

Open jukiewiczm opened 5 months ago

jukiewiczm commented 5 months ago

Hi there! Thank you for creating mamba!

Describe the bug

Mamba fails with

  File "/lib/python3.8/site-packages/mamba/nodetransformers.py", line 81, in _get_name
    return context_expr.func.value.id
AttributeError: 'Attribute' object has no attribute 'id'

How to reproduce it

with context("test context"):
    with it("test case"):
        with mock.patch.object(some_object, "some_attribute") as mocked_attribute:
            print("x")

Expected behavior

It should not fail.

Environment