Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #80582
| Date | 2014-11-11 17:24 -0800 |
|---|---|
| From | Ethan Furman <ethan@stoneleaf.us> |
| Subject | Re: I love assert |
| References | <54627C8A.6080003@stoneleaf.us> <1247729521.81958.1415742364915.JavaMail.yahoo@jws10723.mail.gq1.yahoo.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.15705.1415755472.18130.python-list@python.org> (permalink) |
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
Re: I love assert Ethan Furman <ethan@stoneleaf.us> - 2014-11-11 17:24 -0800
csiph-web