On Tue, May 12, 2015 at 8:19 PM, Mike Dewhirst <[email protected]> wrote:
> On 13/05/2015 5:07 AM, Larry Martell wrote:
>>
>> I have a situation where I need to run an external python script in a
>> test after the tables are loaded from fixtures. This doesn't work
>> because django runs the tests in a transaction and the external python
>> script is running in its own MySQL connection from the test so it's in
>> its own transaction. When the external python script does something
>> that requires a foreign key look up in a table that was loaded from a
>> fixture it finds that table locked because the transaction in the test
>> has not been committed.
>
>
> Can you convert the script into a class and import it? That should let the
> code run within the transaction.

Yes, that is what I ended up doing, but I'm still testing it and
trying to get it to work. The script in turn forked off another
script, so I also had to instantiate that. And now the test is more
different from the production environment then I'd like. It would have
been much easier if I could run the tests with no transaction.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACwCsY60BN_mV0ZdyaRZP-iga_gJ44CFiMwmzaamkUAHmqd0Gg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to