librelist archives

« back to archive

Armin and Dan : UnitTest or Flask-Testing ?

Armin and Dan : UnitTest or Flask-Testing ?

From:
Stephane Wirtel
Date:
2010-09-03 @ 13:25
Hi all,

I want to implement the unittest for my project but I don't know what can I use.

1. Flask-Website doesn't use Flask-Testing and prefer to use the UnitTest 
library from python
   We can call the test suite via setup.py with the "setup.py test" command
   There is a test_suite keyword in the setup() and it refers to 
__main__.test_suite() defined
   in the setup.py file. This function will use the tests defined in the 
tests/ directory

2. NewsMeme uses Flask-Testing but we can't launch the test suite via setup.py

I want to use Flask-Testing and I want to call the test suite from setup.py

Do you have some advices ?

May be, The Flask-Website could use the flask extensions ?
This site doesn't use Flask-Testing, Flask-SQLAlchemy, Flask-Creole, 
etc... Why ? Is there a reason ? financial or time ?

Thank you so much.

Regards,

Stéphane

Re: [flask] Armin and Dan : UnitTest or Flask-Testing ?

From:
Dan Jacob
Date:
2010-09-03 @ 13:30
On 3 September 2010 14:25, Stephane Wirtel <stephane@wirtel.be> wrote:
> Hi all,
>
> I want to implement the unittest for my project but I don't know what can I use.
>
> 1. Flask-Website doesn't use Flask-Testing and prefer to use the 
UnitTest library from python
>   We can call the test suite via setup.py with the "setup.py test" command
>   There is a test_suite keyword in the setup() and it refers to 
__main__.test_suite() defined
>   in the setup.py file. This function will use the tests defined in the 
tests/ directory
>
> 2. NewsMeme uses Flask-Testing but we can't launch the test suite via setup.py
>

I usually use 'nose.collector' for the test_suite in setup.py; I like
nose and it just works. I don't remember if I added this to newsmeme,
I just run nosetests. The reason for having it in the extensions was
just to cover the test requirements for Flask extensions.

> I want to use Flask-Testing and I want to call the test suite from setup.py
>
> Do you have some advices ?
>
> May be, The Flask-Website could use the flask extensions ?
> This site doesn't use Flask-Testing, Flask-SQLAlchemy, Flask-Creole, 
etc... Why ? Is there a reason ? financial or time ?

Probably because it doesn't need these, as it's just some largely
static pages. Adding for example SQLAlchemy support means the extra
hassle of setting up and maintaining a database.

In addition most of these extensions weren't available when the
website was put together.

>
> Thank you so much.
>
> Regards,
>
> Stéphane
>

Re: [flask] Armin and Dan : UnitTest or Flask-Testing ?

From:
Dag Odenhall
Date:
2010-09-03 @ 19:50
On Fri, 2010-09-03 at 14:30 +0100, Dan Jacob wrote:
> > May be, The Flask-Website could use the flask extensions ?
> > This site doesn't use Flask-Testing, Flask-SQLAlchemy, Flask-Creole, 
etc... Why ? Is there a reason ? financial or time ?
> 
> Probably because it doesn't need these, as it's just some largely
> static pages. Adding for example SQLAlchemy support means the extra
> hassle of setting up and maintaining a database.

I think it already does use SQLAlchemy (snippets for example).

> In addition most of these extensions weren't available when the
> website was put together.

This.

Re: [flask] Armin and Dan : UnitTest or Flask-Testing ?

From:
Stephane Wirtel
Date:
2010-09-03 @ 13:49
Dan,
> I usually use 'nose.collector' for the test_suite in setup.py; I like
> nose and it just works. I don't remember if I added this to newsmeme,
> I just run nosetests. The reason for having it in the extensions was
> just to cover the test requirements for Flask extensions.
ok for nose, but question.

What's the difference between unittest (and unittest2), nose.collector, 
py.unit, buildbot ?
Can we use nose.collector with buildbot or instead of buildbot ?

>> May be, The Flask-Website could use the flask extensions ?
>> This site doesn't use Flask-Testing, Flask-SQLAlchemy, Flask-Creole, 
etc... Why ? Is there a reason ? financial or time ?
> 
> Probably because it doesn't need these, as it's just some largely
> static pages. Adding for example SQLAlchemy support means the extra
> hassle of setting up and maintaining a database.
Agree with you, but now there is Flask-OpenID, etc... The website can use them.

In fact, currently, I read your project "newsmeme" and the flask-website 
to understand some things.

A new section called "Flask Recipes" would be very useful for me and may 
be for the community.
> 
> In addition most of these extensions weren't available when the
> website was put together.
But now, we have these extensions ;-) a small update of the website in the
future ?

Thanks,

Stéphane

Re: [flask] Armin and Dan : UnitTest or Flask-Testing ?

From:
Dag Odenhall
Date:
2010-09-03 @ 19:53
On Fri, 2010-09-03 at 15:49 +0200, Stephane Wirtel wrote:
> A new section called "Flask Recipes" would be very useful for me and may
be for the community.

http://flask.pocoo.org/snippets/ ?

> > In addition most of these extensions weren't available when the
> > website was put together.
> But now, we have these extensions ;-) a small update of the website in 
the future ?

I agree the website should be a good example of a good Flask
application, and it's probably a good thing to use (approved)
extensions. Someone needs to do the work though; I bet Armin will accept
patches.

Re: [flask] Armin and Dan : UnitTest or Flask-Testing ?

From:
Dan Jacob
Date:
2010-09-03 @ 23:04
On 3 September 2010 20:53, Dag Odenhall <dag.odenhall@gmail.com> wrote:
> On Fri, 2010-09-03 at 15:49 +0200, Stephane Wirtel wrote:
>> A new section called "Flask Recipes" would be very useful for me and 
may be for the community.
>
> http://flask.pocoo.org/snippets/ ?
>

That's a bit different. Snippets are bits of code used for examples.
The idea of "recipes" would be project templates (however those
templates are defined). That's how I interpret it anyway.

>> > In addition most of these extensions weren't available when the
>> > website was put together.
>> But now, we have these extensions ;-) a small update of the website in 
the future ?
>
> I agree the website should be a good example of a good Flask
> application, and it's probably a good thing to use (approved)
> extensions. Someone needs to do the work though; I bet Armin will accept
> patches.
>
>

Re: [flask] Armin and Dan : UnitTest or Flask-Testing ?

From:
Dan Jacob
Date:
2010-09-03 @ 13:52
On 3 September 2010 14:49, Stephane Wirtel <stephane@wirtel.be> wrote:
> Dan,
>> I usually use 'nose.collector' for the test_suite in setup.py; I like
>> nose and it just works. I don't remember if I added this to newsmeme,
>> I just run nosetests. The reason for having it in the extensions was
>> just to cover the test requirements for Flask extensions.
> ok for nose, but question.
>
> What's the difference between unittest (and unittest2), nose.collector, 
py.unit, buildbot ?
> Can we use nose.collector with buildbot or instead of buildbot ?
>

I don't know, not really used buildbot. Best to refer to nose docs.

>>> May be, The Flask-Website could use the flask extensions ?
>>> This site doesn't use Flask-Testing, Flask-SQLAlchemy, Flask-Creole, 
etc... Why ? Is there a reason ? financial or time ?
>>
>> Probably because it doesn't need these, as it's just some largely
>> static pages. Adding for example SQLAlchemy support means the extra
>> hassle of setting up and maintaining a database.
> Agree with you, but now there is Flask-OpenID, etc... The website can use them.
>
> In fact, currently, I read your project "newsmeme" and the flask-website
to understand some things.
>
> A new section called "Flask Recipes" would be very useful for me and may
be for the community.
>>

I think what would be handy is something like paster, where people can
upload project templates (we can use paste, or something simpler and
homegrown using e.g. jinja2).

>> In addition most of these extensions weren't available when the
>> website was put together.
> But now, we have these extensions ;-) a small update of the website in 
the future ?
>

I think it's a case of "if it ain't broken..."

> Thanks,
>
> Stéphane
>