Wednesday, April 27, 2011

Re: Running tests automatically as you work.

Thanks for sharing! Very useful, indeed.

The sleep() in your script is pretty clever, as I also tend to save
files pretty frequently.


On Wed, Apr 27, 2011 at 5:58 PM, Shawn Milochik <shawn@milochik.com> wrote:
> http://dpaste.com/hold/536487/
>
> I cobbled this little script together that monitors my project folder and
> runs tests every time a .py file is saved. I'm sharing it in case anyone is
> interested. Feedback is welcome, of course.
>
> Interesting bits:
>
>    pyinotify: This module plugs into kernel notifications so you don't have
> to do something horrible like put os.walk in a loop.
>
>    call_command: Kenny Meyer pointed this out to me. It lets you run
> 'manage.py' commands from a Python script.
> http://docs.djangoproject.com/en/dev/ref/django-admin/#running-management-commands-from-your-code
>
>    SystemExit: When sys.exit() is called, you can't catch it with "except
> Exception," because it has a different base class.
>        Thanks to Alex Gaynor for helping me with this one.
>
> --
> 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+unsubscribe@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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate