On Mon, Feb 9, 2009 at 12:13 AM, Vitaly Babiy <vbabi...@gmail.com> wrote:

> Right the problem is if I reload the server on ever test, there is not
> enough time for the thread to kill the server. So when the next setUp comes
> around the port is still in use.
> I think I need to find a way to start a HTTP server at the beginning of the
> test and keep it around till all test are done. And have a way to tell the
> server what to return on the request.
>
> Vitaly Babiy
>
>
> On Mon, Feb 9, 2009 at 12:08 AM, Alex Gaynor <alex.gay...@gmail.com>wrote:
>
>>
>>
>> On Mon, Feb 9, 2009 at 12:06 AM, Vitaly Babiy <vbabi...@gmail.com> wrote:
>>
>>> Hello everyone,
>>>
>>> I am working on a project that will need to make a request out to the web
>>> and pull down some data, For testing purpose I was wonder what would be the
>>> best way to test this. I don't want to make the actual request during the
>>> test, because for one if I am off-line all those tests will fail.
>>>
>>> I have tried to implement a HTTPServer in python. The problem I am having
>>> is once I have it thread, If I put it in the setUp method  and tearDown I
>>> get port in use exception. Due to the nature of the thread it is not
>>> guaranteed to be killed in time.
>>>
>>> Vitaly Babiy
>>>
>>>
>>>
>> You should be able to save the thread on the Test object during setup()
>> and then kill it on teardown() shouldn't you?
>>
>> Alex
>>
>> --
>> "I disapprove of what you say, but I will defend to the death your right
>> to say it." --Voltaire
>> "The people's good is the highest law."--Cicero
>>
>>
>>
>
> >
>
What if you just put a time.sleep(2) at the end of tearDown() that should
give the thread enough time to close before the next test starts.

Alex

-- 
"I disapprove of what you say, but I will defend to the death your right to
say it." --Voltaire
"The people's good is the highest law."--Cicero

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to