Re: How start django server automatically using pytest-django

2018-07-11 Thread 'Anthony Flury' via Django users

On 07/07/18 13:16, prakash sharma wrote:

RE:'do you want to test on development server'
NO, Drone is running the test cases.I don't want to run the runserver 
command.


But why do you need the server running - the Django Test client is able 
to test views and responses without having to have the server running.


If running the Server gives an error, then so will the Test client.

There is no benefit in attempting to run the server within your test cases.




On Saturday, July 7, 2018 at 5:12:51 PM UTC+5:30, Kamal Sharma wrote:

do you want to test on development server??


On Sat, Jul 7, 2018 at 1:17 PM, prakash sharma
> wrote:

Hi there,
I am facing issue that my django server is not started .
I want to run the pytest-django  for test cases without manual
runserver.

Here is my test file:

|importrequests deftest_demo():response
=requests.get('http://0.0.0.0:8000/
'+"demo")assert(response.status_code ==200)|

|
|
|
|
|Here is the cmd:|
|
|
pytest .tests/test_demo.py --ds=my_project.settings
|


|
|
|
|I am getting :|


  Failed to establish a new connection: [Errno 111] Connection
  refused



Is there is  a way that my django server will start
automatically with pytest.
-- 
You received this message because you are subscribed to the

Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from
it, send an email to django-users...@googlegroups.com
.
To post to this group, send email to
django...@googlegroups.com .
Visit this group at
https://groups.google.com/group/django-users
.
To view this discussion on the web visit

https://groups.google.com/d/msgid/django-users/2c166097-9635-4dd0-828c-5b1f3006cf1e%40googlegroups.com

.
For more options, visit https://groups.google.com/d/optout
.


--
You received this message because you are subscribed to the Google 
Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 
an email to django-users+unsubscr...@googlegroups.com 
.
To post to this group, send email to django-users@googlegroups.com 
.

Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/d18ca5b1-6426-405b-8348-91c13ace1bb9%40googlegroups.com 
.

For more options, visit https://groups.google.com/d/optout.



--
--
Anthony Flury
email : *anthony.fl...@btinternet.com*
Twitter : *@TonyFlury *

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/26733bab-8e19-49e3-8cba-54f1fb4aca80%40btinternet.com.
For more options, visit https://groups.google.com/d/optout.


Re: How start django server automatically using pytest-django

2018-07-07 Thread prakash sharma
RE:'do you want to test on development server'
NO, Drone is running the test cases.I don't want to run the runserver 
command.

On Saturday, July 7, 2018 at 5:12:51 PM UTC+5:30, Kamal Sharma wrote:
>
> do you want to test on development server??
>
>
> On Sat, Jul 7, 2018 at 1:17 PM, prakash sharma  > wrote:
>
>> Hi there,
>> I am facing issue that my django server is not started .
>> I want to run the pytest-django  for test cases without manual runserver.
>>
>> Here is my test file:
>>
>> import requests
>>
>> def test_demo():
>> response = requests.get('http://0.0.0.0:8000/' + "demo")
>> assert (response.status_code == 200)
>>
>>
>>
>> Here is the cmd:
>> pytest .tests/test_demo.py --ds=my_project.settings
>>
>>
>>
>> I am getting :
>> Failed to establish a new connection: [Errno 111] Connection refused
>>
>>
>> Is there is  a way that my django server will start automatically with 
>> pytest.
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com 
>> .
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/2c166097-9635-4dd0-828c-5b1f3006cf1e%40googlegroups.com
>>  
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/d18ca5b1-6426-405b-8348-91c13ace1bb9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How start django server automatically using pytest-django

2018-07-07 Thread prakash sharma

@Mikhailo I agree, that we should not use requests. But then what is point 
of using pytest-django then??
I am using pytest-django with the hope that it will manage and restart the 
server itself.


On Saturday, July 7, 2018 at 4:41:25 PM UTC+5:30, Mikhailo Keda wrote:
>
> read more about testing - 
> https://docs.djangoproject.com/en/2.0/topics/testing/
>
> you don't need to use requests, use testing client instead - 
> https://docs.djangoproject.com/en/2.0/topics/testing/tools/#making-requests
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/2a27f655-c163-41f8-9de0-c834b63fe2a2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How start django server automatically using pytest-django

2018-07-07 Thread Kamal Sharma
do you want to test on development server??


On Sat, Jul 7, 2018 at 1:17 PM, prakash sharma 
wrote:

> Hi there,
> I am facing issue that my django server is not started .
> I want to run the pytest-django  for test cases without manual runserver.
>
> Here is my test file:
>
> import requests
>
> def test_demo():
> response = requests.get('http://0.0.0.0:8000/' + "demo")
> assert (response.status_code == 200)
>
>
>
> Here is the cmd:
> pytest .tests/test_demo.py --ds=my_project.settings
>
>
>
> I am getting :
> Failed to establish a new connection: [Errno 111] Connection refused
>
>
> Is there is  a way that my django server will start automatically with
> pytest.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/2c166097-9635-4dd0-828c-5b1f3006cf1e%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHfh8PT4-0XPerJJJfyi52peyxhyKQ1P_HRZurWzKRCC0zcQ0Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How start django server automatically using pytest-django

2018-07-07 Thread Mikhailo Keda
there is an example - 
https://bitbucket.org/voron-raven/tools-site/src/master/tool/tests/tests_views.py

>
to run tests:
python manage.py test

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/31815ceb-17d7-4c04-b9fd-c851e241006d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How start django server automatically using pytest-django

2018-07-07 Thread Mikhailo Keda
read more about testing 
- https://docs.djangoproject.com/en/2.0/topics/testing/

you don't need to use requests, use testing client instead 
- https://docs.djangoproject.com/en/2.0/topics/testing/tools/#making-requests

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/a78fc84f-bc06-4e59-9eb2-fa392a1b74d4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.