def METHOD_NAME(caplog):
    class Foo(m.Circuit):
        io = m.IO(x=m.In(m.Bits[8]), y=m.Out(m.Bits[8]))
        z = m.Bits[8]()
        z @= io.x
        io.y @= z
    # Should not raise an error
    m.compile("build/Foo", Foo)
    class Bar(m.Circuit):
        io = m.IO(x=m.In(m.Bits[8]), y=m.Out(m.Bits[8]))
        io.y @= Foo.z
    with pytest.raises(MagmaCompileException) as e:
        m.compile("build/Bar", Bar)
    assert str(e.value) == ("Cannot wire Foo.x to Bar.y because they are not "
                            "from the same definition context")