Thanks! Yeah, I don't actually need to print out the class. That was just
for my little test program.
I hope to try out CaptureMock again soon with the real code I was using.
I'm trying to mock out a SQL Server database so that I can run the tests
quickly and without needing the database.
On Thu, May 8, 2014 at 12:27 PM, Geoff Bache <email address hidden> wrote:
> I checked in a fix for the double-import issue now.
>
> I haven't really thought of a good way to fix the class-printout issue
> yet, though I don't really know if it's important to you or was just
> illustrating the other issue.
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1315129
>
> Title:
> Trouble with intercepting/playing back submodule (sqlalchemy.exc)
>
> Status in CaptureMock:
> New
>
> 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.process_startup()
>
>
> def foo():
> import sqlalchemy
> print(sqlalchemy.__version__)
> from sqlalchemy.exc import OperationalError
> print(OperationalError)
>
>
> foo()
>
> $cat config
> [python]
> intercepts = sqlalchemy,sqlalchemy.exc
> ```
>
> 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_PROCESS_START=config CAPTUREMOCK_MODE=2
> CAPTUREMOCK_RECORD_FILE=foo.mock CAPTUREMOCK_REPLAY_FILE=foo.mock python
> foobar.py
> 0.8.6
> <class 'sqlalchemy.exc.OperationalError'>
>
> $ cat foo.mock
> <-PYT:import sqlalchemy
> <-PYT:sqlalchemy.__version__
> ->RET:'0.8.6'
> ```
>
> So here it recorded that I imported sqlalchemy and called
> sqlalchemy.__version__ but it didn't record my import of
> sqlalchemy.exc or usage of OperationalError... That doesn't seem right
> to me. Then when I run it again to replay what's in the file, it
> complains because it can't find the submodule sqlalchemy.exc:
>
> ```
> $ CAPTUREMOCK_PROCESS_START=config CAPTUREMOCK_MODE=2
> CAPTUREMOCK_RECORD_FILE=foo.mock CAPTUREMOCK_REPLAY_FILE=foo.mock python
> foobar.py
> 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?
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/capturemock/+bug/1315129/+subscriptions
>
Thanks! Yeah, I don't actually need to print out the class. That was just
for my little test program.
I hope to try out CaptureMock again soon with the real code I was using.
I'm trying to mock out a SQL Server database so that I can run the tests
quickly and without needing the database.
On Thu, May 8, 2014 at 12:27 PM, Geoff Bache <email address hidden> wrote:
> I checked in a fix for the double-import issue now. /bugs.launchpad .net/bugs/ 1315129 playing back submodule (sqlalchemy.exc) process_ startup( ) y.__version_ _) alError) sqlalchemy. exc PROCESS_ START=config CAPTUREMOCK_MODE=2 RECORD_ FILE=foo. mock CAPTUREMOCK_ REPLAY_ FILE=foo. mock python exc.Operational Error'> y.__version_ _ __version_ _ but it didn't record my import of PROCESS_ START=config CAPTUREMOCK_MODE=2 RECORD_ FILE=foo. mock CAPTUREMOCK_ REPLAY_ FILE=foo. mock python /bugs.launchpad .net/capturemoc k/+bug/ 1315129/ +subscriptions
>
> I haven't really thought of a good way to fix the class-printout issue
> yet, though I don't really know if it's important to you or was just
> illustrating the other issue.
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https:/
>
> Title:
> Trouble with intercepting/
>
> Status in CaptureMock:
> New
>
> 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(sqlalchem
> from sqlalchemy.exc import OperationalError
> print(Operation
>
>
> 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_
> CAPTUREMOCK_
> foobar.py
> 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.
> sqlalchemy.exc or usage of OperationalError... That doesn't seem right
> to me. Then when I run it again to replay what's in the file, it
> complains because it can't find the submodule sqlalchemy.exc:
>
> ```
> $ CAPTUREMOCK_
> CAPTUREMOCK_
> foobar.py
> 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?
>
> To manage notifications about this bug go to:
> https:/
>