Thanks for the suggestions and guidance Russ. I'll work with it a bit
more and see if it pans out.

My main concern with this working smoothly in the core has to do with
when and how application code is loaded in the process of setting up
tests. It turns out the earliest we can realistically send the
test_setup signal is in the build_suite() method, right after the
get_app() / get_apps() functions have executed, i.e. the applications
themselves have been loaded. Prior to this any attempts to connect()
to the signal won't get picked up, because no applications have been
loaded.

There's also a related issue, which is that if you run individual
tests or sets of tests for an application, it doesn't appear that
other applications get loaded. This means that, in a given
application, I might add a hook and expect it to run whenever tests
for the project are run, but it wouldn't in fact run unless that
application was included in the test. So e.g. if I wanted to disable
certain behavior whenever tests were run, that might not in fact
happen. That said, I guess if another application includes the
application where the hooks live, those connect() calls would get set
up at the same time. Not sure if what I'm saying is totally clear, but
I guess the point is there are a few more complexities here in the
setup process than might first meet the eye.

Also, given the above, it might not be realistic to configure the
existing setup code to run via this signal, since the signal happens
so much later in the process.

The solution is probably for me to think this through a bit more and
see if there isn't a way to send the test_setup signal where one would
expect it should be sent (i.e. at the end of the
setup_test_environment() method in the suite runner) and at the same
time ensure that applications have a way to connect to the signal.
I'll give it some thought.

Thank you again for the support and suggestions.

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-develop...@googlegroups.com.
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en.

Reply via email to