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


Groups > comp.lang.python > #80582

Re: I love assert

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed4a.news.xs4all.nl!xs4all!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.002
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'error:': 0.07; '__name__': 0.09; 'from:addr:ethan': 0.09; 'from:addr:stoneleaf.us': 0.09; 'from:name:ethan furman': 0.09; 'main()': 0.09; 'message- id:@stoneleaf.us': 0.09; 'unittest': 0.09; '~ethan~': 0.09; 'python': 0.11; 'def': 0.12; "'__main__':": 0.16; 'mode,': 0.16; 'nose': 0.16; 'option:': 0.16; 'wrote:': 0.18; 'code.': 0.18; 'module': 0.19; 'import': 0.22; 'tests': 0.22; 'to:name:python- list@python.org': 0.22; 'header:User-Agent:1': 0.23; 'certainly': 0.24; 'stick': 0.24; "haven't": 0.24; 'header:In-Reply-To:1': 0.27; "doesn't": 0.30; 'apparently': 0.31; 'class': 0.32; 'skip:- 30': 0.32; 'run': 0.32; 'test': 0.35; 'words,': 0.36; "i'll": 0.36; 'handle': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'to:addr:python.org': 0.39; 'read': 0.60; 'received:173': 0.61; 'such': 0.63; 'optimized': 0.68; 'ethan': 0.84; 'furman': 0.84; 'hand,': 0.93
Date Tue, 11 Nov 2014 17:24:27 -0800
From Ethan Furman <ethan@stoneleaf.us>
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121010 Thunderbird/16.0.1
MIME-Version 1.0
To "python-list@python.org" <python-list@python.org>
Subject Re: I love assert
References <54627C8A.6080003@stoneleaf.us> <1247729521.81958.1415742364915.JavaMail.yahoo@jws10723.mail.gq1.yahoo.com>
In-Reply-To <1247729521.81958.1415742364915.JavaMail.yahoo@jws10723.mail.gq1.yahoo.com>
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
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.15705.1415755472.18130.python-list@python.org> (permalink)
Lines 54
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1415755472 news.xs4all.nl 2941 [2001:888:2000:d::a6]:47741
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:80582

Show key headers only | View raw


On 11/11/2014 01:46 PM, Albert-Jan Roskam wrote:
> Ethan Furman wrote:
>>
>> I don't know, haven't used it nor read the code.  It would certainly not
>> be good if it failed in optimized mode.
>
> antonia@antonia-HP-2133 /tmp $ python -O test.py
> Ran 2 tests in 0.015s
> OK
>
> antonia@antonia-HP-2133 /tmp $ python -O -m nose test.py
> Ran 2 tests in 0.003s
> OK
>
> antonia@antonia-HP-2133 /tmp $ python test.py
> Ran 2 tests in 0.044s
> FAILED (failures=2)
>
> antonia@antonia-HP-2133 /tmp $ python -m nose test.py
> Ran 2 tests in 0.044s
> FAILED (failures=2)
>
> antonia@antonia-HP-2133 /tmp $ nosetests -O -v test.py
> Usage: nosetests [options]
>
> nosetests: error: no such option: -O   # phweeew

In other words, nose the module doesn't handle optimized mode, and apparently nosetests cannot run in optimized mode.

On the other hand, unittest:
--------------------------------------
from unittest import TestCase, main

class TestTest(TestCase):
     def test_optimized(self):
         self.assertTrue(1 == 2)

if __name__ == '__main__':
     main()
--------------------------------------

ethan@media:~/source$ python3.4 test.py
Ran 1 test in 0.001s
FAILED (failures=1)

ethan@media:~/source$ python3.4 -O test.py
Ran 1 test in 0.001s
FAILED (failures=1)


I'll stick with unittest.

--
~Ethan~

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


Thread

Re: I love assert Ethan Furman <ethan@stoneleaf.us> - 2014-11-11 17:24 -0800

csiph-web