Oops, forgot to include link to similar-ish bug: 
http://trac.turbogears.org/ticket/2404

On Dec 7, 3:40 pm, James <[email protected]> wrote:
> Hi all,
> I'm trying to figure out a way to mock objects on a TG2 controller.
>
> In TG1, I was able to import that controller, and inject mocked
> objects into the module, e.g.:
>
> from tg1_proj.controllers import root
> root.boto = Mock('boto')
>
> However, I've found that in TG2 importing controllers before they've
> been used causes problems with the DB set-up code:
>
> from tg2_proj.controllers import root
> root.boto = Mock('boto')
>
> in the setUp() method of the base TestController object causes
> (OperationalError) no such table errors.
>
> It's the same symptom as I found in ###, where the engine being used
> wasn't consistent across test setup, body and teardown, but I don't
> immediately see how pre-emptively importing a model could cause the
> same thing...
>
> In short, what would be best practice to mock something imported in a
> controller, before that controller is used?

--

You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en.


Reply via email to