Re: Running Django tests from Python

2011-04-27 Thread Shawn Milochik

On 04/27/2011 04:06 PM, Kenny Meyer wrote:

Hi Shawn,

http://docs.djangoproject.com/en/dev/ref/django-admin/#running-management-commands-from-your-code

Does this answer your question?

Kenny


Never mind. More pdb action and I figured out that I had overwritten 
DJANGO_SETTINGS_MODULE at the bash prompt I was using to try this. All 
my fault. Yay.


Now it works, thanks.

Shawn


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



Re: Running Django tests from Python

2011-04-27 Thread Shawn Milochik

On 04/27/2011 04:06 PM, Kenny Meyer wrote:

Hi Shawn,

http://docs.djangoproject.com/en/dev/ref/django-admin/#running-management-commands-from-your-code

Does this answer your question?

Kenny


Kenny,

This is *exactly* what I was looking for.

Unfortunately it doesn't work. It keeps saying that an app with that 
label can not be found.


I've traced it down to django.db.models.loading.py, which imports 
settings from django.conf, but it's
always 'django.conf.LazySettings object' instead of the proper settings 
file.


This is odd, because os.environ['DJANGO_SETTINGS_MODULE'] is properly 
set if I check it in pdb during that function.


I've even tried passing my settings module as a kwarg as described in 
the doc you sent which doesn't work either.

In any case, I'm using the default -- 'settings.py' in the project folder.

Any ideas?

Thanks,
Shawn

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



Re: Running Django tests from Python

2011-04-27 Thread Kenny Meyer
Hi Shawn,

http://docs.djangoproject.com/en/dev/ref/django-admin/#running-management-commands-from-your-code

Does this answer your question?

Kenny



On Wed, Apr 27, 2011 at 12:41 PM, Shawn Milochik  wrote:
> Sorry, I realize that last post is missing the context of the original
> question.
> Please see
> this: https://groups.google.com/d/topic/django-users/-4f3J1bJ10k/discussion
> Thanks,
> Shawn
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

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



Re: Running Django tests from Python

2011-04-27 Thread Shawn Milochik
Sorry, I realize that last post is missing the context of the original 
question.

Please see 
this: https://groups.google.com/d/topic/django-users/-4f3J1bJ10k/discussion

Thanks,
Shawn

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



Re: Running Django tests from Python

2011-04-27 Thread Shawn Milochik
I figure it's been long enough that I can bump this post.

I'm currently using subprocess to do this. There must be an easy way to 
simply invoke the tests from within Python.

So, how do you (within Python), do the equivalent of the following?:
./manage.py test myapp1, myapp2, myapp3

Thanks,
Shawn

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



Running Django tests from Python

2011-04-21 Thread Shawn Milochik
I want to use pyinotify[1] to monitor my project directory and run my
unit tests whenever I save a .py file.

The monitoring part is working. All I need now is to know how to call
the tests from my "watcher" script.

As noted in the docs[2], I'm already running  setup_test_environment()
in my script.

Now, how do I do the equivalent of the following from within my Python script?
python manage.py test myapp1 myapp2

[1] https://github.com/seb-m/pyinotify
[2] 
http://docs.djangoproject.com/en/1.3/topics/testing/#running-tests-outside-the-test-runner

Thanks,
Shawn

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