Path: csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.016 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; '__name__': 0.07; 'unittest': 0.07; 'cc:addr:python-list': 0.10; 'def': 0.10; "'__main__':": 0.16; 'oserror.': 0.16; 'to:addr:web.de': 0.16; 'translate': 0.20; 'import': 0.21; 'exceptions': 0.22; 'produces': 0.22; 'cc:2**0': 0.23; 'example': 0.23; 'cc:no real name:2**0': 0.24; 'second': 0.24; 'cc:addr:python.org': 0.25; 'header:In- Reply-To:1': 0.25; 'message-id:@mail.gmail.com': 0.27; 'run': 0.28; 'assert': 0.29; 'behaviour': 0.29; 'url:mailman': 0.29; 'no,': 0.29; 'probably': 0.29; 'class': 0.29; 'maybe': 0.29; 'basic': 0.30; 'code': 0.31; 'url:python': 0.32; 'url:listinfo': 0.32; 'received:google.com': 0.34; 'fail': 0.35; 'false': 0.35; 'received:209.85': 0.35; 'but': 0.36; 'url:org': 0.36; 'method': 0.36; 'test': 0.36; 'received:209': 0.37; 'subject:: ': 0.38; 'header:Received:5': 0.40; 'help': 0.40; 'url:mail': 0.40; 'easy': 0.60; 'skip:u 10': 0.60; 'first': 0.61; 'gave': 0.65; 'otten': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=iK2Hpv5FfXLFvZvDgOCl7KoX8lW3jswSwi0x/Y95JJo=; b=lyCt6hfhMVjMNP6Cy80YcRf8AQwEEkUlwQfl2Wo8yEXbcNuFYVPy+0WSDwwALIfkn3 S8Dae5w1wtVaSk7pnPlvgg/JePj3Nx4k2dfj7jWNMmBYYiHfF1d3K3DqzNWbdM3/JBZA BpGFUoNVxyiV6sZVU/yHzzLpKrSFZq2wpCrM4e9i2OX099iRLnG0/auGwSIVTPQn9ovq T+Rtbqb5icgWZcqPhdP3gxqqmobPAIC3gSg5zwuvgqjxb9ayDml+DFHpicDqbsTvGzZc sPPF7xpEhzpEeocAYXUSJVb3qL0EzL+OOrLL0X1EpG9+PhMVNsDi2Lf37UCdUy/5rewZ 5OMg== MIME-Version: 1.0 In-Reply-To: References: Date: Tue, 17 Jul 2012 10:06:36 +0100 Subject: Re: assertraises behaviour From: andrea crotti To: Peter Otten <__peter__@web.de> Content-Type: text/plain; charset=ISO-8859-1 Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 28 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1342515998 news.xs4all.nl 6849 [2001:888:2000:d::a6]:47422 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:25475 2012/7/16 Peter Otten <__peter__@web.de>: > No, I don't see how the code you gave above can fail with an OSError. > > Can you give an example that produces the desired behaviour with nose? Maybe > we can help you translate it to basic unittest. > > -- > http://mail.python.org/mailman/listinfo/python-list Well this is what I meant: import unittest class TestWithRaises(unittest.TestCase): def test_first(self): assert False def test_second(self): print("also called") assert True if __name__ == '__main__': unittest.main() in this case also the second test is run even if the first fails.. But that's probably easy because we just need to catch exceptions for every method call, so it's not exactly the same thing..