OK, I've identified two things that cause problems here:
1) The double-importing, once via the main package and once via the submodule. For some reason this confuses things.
2) Printing an intercepted class (rather than object). This doesn't seem to call any hooks, and our methodology with class objects is not to record them until something happens with them, which usually looks nicer... but in this case nothing ever happens with it. I don't know if you really need to do this or if it was just illustrating the point.
Don't know if it helps to workaround, but here's a closely related foobar.py that works just fine:
OK, I've identified two things that cause problems here:
1) The double-importing, once via the main package and once via the submodule. For some reason this confuses things.
2) Printing an intercepted class (rather than object). This doesn't seem to call any hooks, and our methodology with class objects is not to record them until something happens with them, which usually looks nicer... but in this case nothing ever happens with it. I don't know if you really need to do this or if it was just illustrating the point.
Don't know if it helps to workaround, but here's a closely related foobar.py that works just fine:
```
$ cat foobar.py
import capturemock
capturemock. process_ startup( )
def foo(): sqlalchemy. __version_ _) sqlalchemy. exc.Operational Error(" one", "two", "three"))
import sqlalchemy
print(
print(
foo()
```
Will take another look at this either on Thursday or next week.