Comment 2 for bug 1315129

Revision history for this message
Geoff Bache (geoff.bache) wrote :

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():
    import sqlalchemy
    print(sqlalchemy.__version__)
    print(sqlalchemy.exc.OperationalError("one", "two", "three"))

foo()
```

Will take another look at this either on Thursday or next week.