Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

seems to break testing #25

Open
GoogleCodeExporter opened this issue Dec 16, 2015 · 1 comment
Open

seems to break testing #25

GoogleCodeExporter opened this issue Dec 16, 2015 · 1 comment

Comments

@GoogleCodeExporter
Copy link

In my project I have one very simple test case. It runs fine.

But when I have djang_cron installed, the tests run fine, but ./manage.py tests 
fails to exit.

I see:
imac:server adam$ ./manage.py test gui
Creating test database for alias 'default'...
..
----------------------------------------------------------------------
Ran 2 tests in 0.028s

OK
Destroying test database for alias 'default'...

And it doesn't ever return - i need to ctrl-z/kill %1 to kill it.

 I have one cron job running every that is just:


from django_cron import cronScheduler, Job
from models import Session
from datetime import datetime

TIMEOUT = (60*5) # 5 mins

class CheckTimeouts(Job):    
    run_every = 60
                    def job(self):
        for s in Session.objects.filter(end_time = None ):
            if (datetime.now() - s.last_saved).seconds > TIMEOUT:
                s.end_time = s.last_saved
                s.save()

cronScheduler.register(CheckTimeouts)



The session filter in the scheduler doesn't return any objects in my database, 
so it isn't as though the job is running.


My guess is that the process is trying to exit at the end of the tests, but is 
waiting for threads to return.


Original issue reported on code.google.com by adamtw...@gmail.com on 2 Jun 2011 at 11:45

@GoogleCodeExporter
Copy link
Author

Here's my diff to base.py to make it a daemon thread instead of 
threading.Timer() which solves the issue (see: 
http://stackoverflow.com/questions/5952910/python-cancel-timer-thread) for some 
background)::

Original comment by adamtw...@gmail.com on 2 Jun 2011 at 12:57

Attachments:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant