Trouble with intercepting/playing back submodule (sqlalchemy.exc)
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
CaptureMock |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
This might be a bug or it might be my misunderstanding of how things are supposed to work.
I have this program and CaptureMock config:
```
$ cat foobar.py
import capturemock
capturemock.
def foo():
import sqlalchemy
print(
from sqlalchemy.exc import OperationalError
print(
foo()
$cat config
[python]
intercepts = sqlalchemy,
```
Then I attempt to record/replay to a file.
```
$ cat /dev/null > foo.mock
$ ls -l foo.mock
-rw-r--r-- 1 marca staff 0 May 1 12:49 foo.mock
$ CAPTUREMOCK_
0.8.6
<class 'sqlalchemy.
$ cat foo.mock
<-PYT:import sqlalchemy
<-PYT:sqlalchem
->RET:'0.8.6'
```
So here it recorded that I imported sqlalchemy and called sqlalchemy.
```
$ CAPTUREMOCK_
0.8.6
Traceback (most recent call last):
File "foobar.py", line 13, in <module>
foo()
File "foobar.py", line 9, in foo
from sqlalchemy.exc import OperationalError
ImportError: No module named exc
```
Is this a bug or am I misnderstanding how things are supposed to work?
Changed in capturemock: | |
status: | Fix Committed → Fix Released |
Yes, this is a bug alright. It's curious because I've seen similar things work with other submodules (there are some in the test suite) so I don't yet know what's different about sqlalchemy in this respect.