Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #56699

Re: Skipping decorators in unit tests

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <ethan@stoneleaf.us>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.023
X-Spam-Evidence '*H*': 0.95; '*S*': 0.00; 'decorator': 0.09; 'from:addr:ethan': 0.09; 'from:addr:stoneleaf.us': 0.09; 'from:name:ethan furman': 0.09; 'message-id:@stoneleaf.us': 0.09; '~ethan~': 0.09; 'bug': 0.12; 'accepts': 0.16; 'behave': 0.16; 'camp': 0.16; 'inputs': 0.16; 'philosophy.': 0.16; 'received:70.85.130': 0.16; 'rides)': 0.16; 'roy': 0.16; 'simpson': 0.16; 'wrote:': 0.18; 'all,': 0.19; '>>>': 0.22; 'tests': 0.22; 'header:User-Agent:1': 0.23; "aren't": 0.24; 'test.': 0.24; 'certain': 0.27; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'testing': 0.29; 'rest': 0.29; 'especially': 0.30; "i'm": 0.30; 'easier': 0.31; 'usually': 0.31; 'faster,': 0.31; 'lies': 0.31; 'piece': 0.31; 'know.': 0.32; 'stuff': 0.32; 'interface': 0.32; 'used,': 0.33; 'knowledge': 0.35; 'except': 0.35; 'test': 0.35; 'but': 0.35; 'there': 0.35; 'edge': 0.36; 'functions.': 0.36; 'sequence': 0.36; 'done': 0.36; 'charset:us- ascii': 0.36; 'should': 0.36; 'easily': 0.37; 'skip:o 20': 0.38; 'system,': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'that,': 0.38; 'to:addr:python.org': 0.39; 'how': 0.40; 'skip:u 10': 0.60; "you're": 0.61; 'complete': 0.62; 'more': 0.64; 'smith': 0.68; 'anyone.': 0.74; 'article': 0.77; 'batchelder': 0.84; 'guts': 0.84; 'seldom': 0.84; 'banner': 0.93; 'imagine': 0.93; 'lucky': 0.93
Date Fri, 11 Oct 2013 10:46:38 -0700
From Ethan Furman <ethan@stoneleaf.us>
User-Agent Mozilla/5.0 (X11; Linux i686; rv:16.0) Gecko/20121010 Thunderbird/16.0.1
MIME-Version 1.0
To python-list@python.org
Subject Re: Skipping decorators in unit tests
References <52573BED.40305@nedbatchelder.com> <mailman.978.1381459605.18130.python-list@python.org> <roy-11309E.23014310102013@news.panix.com>
In-Reply-To <roy-11309E.23014310102013@news.panix.com>
Content-Type text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding 7bit
X-AntiAbuse This header was added to track abuse, please include it with any abuse report
X-AntiAbuse Primary Hostname - gator3304.hostgator.com
X-AntiAbuse Original Domain - python.org
X-AntiAbuse Originator/Caller UID/GID - [47 12] / [47 12]
X-AntiAbuse Sender Address Domain - stoneleaf.us
X-BWhitelist no
X-Source
X-Source-Args
X-Source-Dir
X-Source-Sender ([192.168.1.115]) [50.39.86.194]:40084
X-Source-Auth ethan+stoneleaf.us
X-Email-Count 6
X-Source-Cap dG9idWs7dG9idWs7Z2F0b3IzMzA0Lmhvc3RnYXRvci5jb20=
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.1011.1381516410.18130.python-list@python.org> (permalink)
Lines 36
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1381516410 news.xs4all.nl 16005 [2001:888:2000:d::a6]:52052
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:56699

Show key headers only | View raw


On 10/10/2013 08:01 PM, Roy Smith wrote:
> On 10Oct2013 19:44, Ned Batchelder <ned@nedbatchelder.com> wrote:
>>> I have to admit I'm having a hard time understanding why you'd need
>>> to test the undecorated functions.  After all, the undecorated
>>> functions aren't available to anyone.  All that matters is how they
>>> behave with the decorators.
>
> In article <mailman.978.1381459605.18130.python-list@python.org>,
>   Cameron Simpson <cs@zip.com.au> wrote:
>> If the undecorated function is buggy, the decorated function will
>> be buggy. But the bug will be harder to resolve, and if you're
>> especially lucky the decorator will often-but-not-always conceal
>> the bug in the inner function.
>
> And there lies the fundamental white-box vs. black-box testing conundrum.
>
> The black-box camp (whose flag Ned is flying) says, "There is an exposed
> interface which accepts certain inputs and promises certain outputs.
> That's all you know, that's all you ever can know, and that's all you
> should ever want to know.  The interface is constant.  The guts can
> change without notice".  That's a perfectly valid philosophy.
>
> The white-box camp (under which banner Cameron rides) says, "There's a
> lot of neat stuff under the covers, and I can do a better, faster, and
> more complete testing job if I take advantage of my knowledge of what's
> under the kimono".  That, too, is a valid philosophy.

Some tests can also be done much more easily with white-box.  Imagine an 
edge case which takes an exact that requires an exact, seldom used, 
sequence of events because an internal bug is usually counteracted by 
the rest of the system, except in some small number of cases.  Directly 
testing the internal piece directly for the bug can be much easier than 
setting up the long and involved test.

--
~Ethan~

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Re: Skipping decorators in unit tests Cameron Simpson <cs@zip.com.au> - 2013-10-11 13:22 +1100
  Re: Skipping decorators in unit tests Roy Smith <roy@panix.com> - 2013-10-10 23:01 -0400
    Re: Skipping decorators in unit tests Ethan Furman <ethan@stoneleaf.us> - 2013-10-11 10:46 -0700

csiph-web